ARTICLE AD BOX
How can you specify the number of ticks since a certain point in time without knowing the time zone of that time?
By thinking of it as being independent of any specific time zone, basically. The important thing to understand is that a DateTime with a Kind of Unspecified doesn't represent an instant in time - it represents what in Noda Time we call a LocalDateTime (at least sort of; there's the whole calendar system aspect to consider as well).
Even if you ignore the Ticks property itself, just consider "8am on March 1st 2026" (and no time zone) for example - that's an example of what a DateTime with a kind of Unspecified can represent. That date/time happened at different instants in time in different time zones around the world, but in some circumstances it can still be a useful concept.
As has already been mentioned in comments, if you use my Noda Time library you won't get this sort of ambiguity. But if you want to stick with the BCL types (which is a reasonable choice) and represent an instant in time, you can either use DateTimeOffset, or always make sure you use a DateTimeKind of Utc.
1.5m895 gold badges9.3k silver badges9.4k bronze badges
4 Comments
Thank you for the input. I guess what I don't understand is that if Ticks is the number of ticks since the reference time but you don't know what which version of the reference time you're talking about, how does the framework compute the value? It has to be picking some time zone to use (presumably local or utc). I can't see how else could come up with a single value to give you.
2026-03-02T20:49:08.563Z+00:00
@d512: It's not really picking a time zone. It's an abstract reference point without being in any time zone... or perhaps you might prefer to think of it as "a time zone with no transitions". Suppose I were to say the reference time was "January 1st, 2000, at midnight" - adding (say) 24 hours to that would get you January 2nd, 2000, at midnight... all you need to know is that there are no transitions. You still don't have an instant in time (because it would mean different things if different time zones were applied) but you can do all the arithmetic.
2026-03-03T07:57:12.5Z+00:00
Perhaps you have confused the time zone and calendar? By default, dates are expressed in the Gregorian calendar, which follows the well-known calculation rule:
1 day = 86400 seconds 1 year has 365 or 366 days based on the year valueObserving the table below
| 0 | 0001-01-01 00:00:00.0000000 |
| 1 | 0001-01-01 00:00:00.0000001 |
| 86400 * 1E7 | 0001-01-02 00:00:00.0000000 |
| 365 * 86400 * 1E7 | 0002-01-01 00:00:00.0000000 |
| 621355968000000000 | 1970-01-01 00:00:00.0000000 |
| 639081143060012345 | 2026-03-03 05:58:26.0012345 |
It can be seen that without considering daylight saving time, you can calculate them without knowing the time zone. So Ticks represent the count of 100 nanoseconds that have passed since 0001-01-01, it's not related to Kind.
The Kind property only needs to be considered when comparing two DateTimes or converting a DateTime to another time zone.
31k7 gold badges39 silver badges73 bronze badges
Explore related questions
See similar questions with these tags.


