-6

Quick question: how can I get 6 digits milliseconds? the limit is 3. other alternatives? suggestions?

DateTime dt = new DateTime(2008, 08, 08, 08, 10, 10, 100)
Farhad Jabiyev
  • 24,866
  • 7
  • 63
  • 96
John Ryann
  • 2,163
  • 11
  • 41
  • 57
  • 9
    Milliseconds are thousands of a second. There are only 3 digits for that (0-999) – Philippe Leybaert Jul 28 '14 at 16:08
  • You probably are trying to set microseconds or nanoseconds? If so have a look at this SO answer. http://stackoverflow.com/questions/5358860/is-there-a-high-resolution-microsecond-nanosecond-datetime-object-available-f – Kevin Jul 28 '14 at 16:14

1 Answers1

7

Milli is a prefix meaning thousands. Thus, one millisecond is one thousandth of a second. What you probably mean by "6 digit milliseconds" is microseconds.

Luckily, DateTime internally stores Ticks with a resolution of 100 nanoseconds (= 0.1 microseconds), so you can just read the Tick property and divide it by 10 to get the total number of microseconds that have elapsed since 12:00:00 midnight, January 1, 0001.

Heinzi
  • 159,022
  • 53
  • 345
  • 499