EN
C# / .NET - convert DateTime to date only
13 points
In C# / .NET it is possible to get date part of DateTime
object in the following way.
xxxxxxxxxx
1
DateTime now = DateTime.Now.Date; // date only
2
3
Console.WriteLine(now.ToString());
Output:
xxxxxxxxxx
1
08/14/2019 00:00:00
Notes:
- this example has been run with independent culture.
- time part is set to zeros after
Date
property has been used.