EN
C# / .NET - DateTime.Now precision
9
points
Using DateTime
structure in C# / .NET it is possible make operations with maximal precision 100 ns, so it is impossible to see difference during operating on times that are smaller than 100 ns.
DateTime.Now
property precision example
DateTime now = DateTime.Now;
Console.WriteLine($"{now:o}");
Output:
2019-08-20T21:38:06.2885653+01:00
Where:
- 2019 - year
- 08 - month (August)
- 20 - day of month
- 21 - hour
- 38 - minute
- 06 - second
- 288 - millisecond part (from: ...2885653...)
- 565 - microsecond part (from: ...2885653...)
- 300 - nanosecond part (from: ...2885653...)
- +01:00 - time offset (GMT+1)
Note: as it has been shown it is possible only to get multiple of one hundred of nanoseconds of DateTime
.