What .NET ticks are
In .NET a DateTime is stored as a single number called ticks. One tick is 100
nanoseconds, and the count starts at midnight on 1 January of the year 1. That
fine resolution and distant origin make raw tick values hard to read, so this
tool converts them to ordinary UTC dates and back, keeping full precision the
whole way.
How it works
The key constant is the tick value of the Unix epoch. Midnight on 1 January 1970 is 621,355,968,000,000,000 ticks. To turn a tick count into a date the tool subtracts that offset, divides by 10,000 to reach milliseconds for a standard date object, and then re-attaches the leftover 100-nanosecond fraction so nothing is lost. The reverse direction multiplies the date’s milliseconds by 10,000 and adds the epoch offset back.
All of this is done with BigInt, because a 64-bit tick count is far larger than the range a JavaScript number can hold exactly.
638000000000000000 -> 2022-09-28T22:13:20Z
2022-09-12T07:46:40Z -> 637985656000000000
Example and notes
Tick values you encounter in logs and serialized objects are almost always in
UTC, which is how this tool interprets and emits them. If you have a local time
instead, convert it to UTC before entering it, otherwise the result will be off
by your timezone offset. The maximum supported value is the final tick of the
year 9999, matching DateTime.MaxValue; larger inputs are rejected as out of
range.