Top community members
All Wiki Articles Create Wiki Article

Have you ever heard about encyclopedia for code?

What about: Wiki for Code project?

* because I've tried to share code and my solutions on different services and it was removed or I was unwelcomed
   - maybe it wasn't good place, but this one is.

if you think you have solution that can help someone, you are welcome to share this solution - Click here

C# / .NET - DateTime.Now precision

0 contributions
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

References

  1. DateTime.Now Property - Microsoft Docs
0 contributions

Checkout latest Findings & News:

Checkout latest questions:

Checkout latest wiki articles:

Hey 👋
Would you like to know what we do?
  • Dirask is IT community, where we share coding knowledge and help each other to solve coding problems.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.
Read more