Friday 3 February 2017

C# Ticks to human-readable date/time

Problem:

I'd like to get a human-readable date/time for a number of Ticks in C#.

Tool:

Try the tool below :)

Ticks:
DateTime(UTC):
DateTime(local):

(Please note that this might not work in all browsers due to limitations in number size that a browser can handle. Also, please let me know if I goofed up the calculation. Thanks!)

Notes on calculation:

  • ticks to microtime = ticks / 10000
  • microtime to Unix time = microtime - 62135596800000
  • then convert Unix time to human-readable using Javascript Date()

References: