This post will discuss how to get the current date in UTC without time in C#.

The DateTime.UtcNow property returns a DateTime object whose value is the current UTC date and time. To get the date component of DateTime.Now, we can use any of the following methods:

1. Using DateTime.ToString() method

The DateTime.ToString() method can be used to get the string representation of the current DateTime object in a specified format.

Download  Run Code

 
Alternatively, we can use the Short Date d format specifier, which displays the current DateTime object value using a short date pattern.

Download  Run Code

 
We can also use the Long Date D format specifier that displays the current DateTime object value using a long date pattern.

Download  Run Code

2. Using DateTime.ToShortDateString() method

The DateTime.ToShortDateString() method can be used to convert the value of the current DateTime object to its equivalent short date string representation.

Download  Run Code

3. Using DateTime.ToLongDateString() method

The DateTime.ToLongDateString() method can be used to convert the value of the current DateTime object to its equivalent long date string representation.

Download  Run Code

4. Using DateTime.GetDateTimeFormats() method

The DateTime.GetDateTimeFormats() method returns an array of all the string representations of the current DateTime object supported by the specified format specifier. The idea is to pass the d format specifier to the method and print the first value in the returned array.

Download  Run Code

That’s all about getting the current date without time in C#.