Reputation: 20190
So, System.currentTimeMillis returns millis in UTC timezone. Is DateTime.getmillis the same as nearly all libraries I know the millis since epoch is always in UTC? Is joda-time the same as well?
thanks, Dean
Upvotes: 3
Views: 5887
Reputation: 75906
System.currentTimeMillis returns millis in UTC timezone
That's incorrect. System.currentTimeMillis
returns a time interval (measured in milliseconds), from a particular (well specified, universally) instant in time (tA), till other instant in time (tB=the current moment). Both instants are points in the "physical" timeline, they are not related at all with timezones.
The confusion might arise because the "initial" time (tA) is specified as "January 1, 1970 00:00:00 UTC" but, that's irrelevant, that's just a way of specifying univocally an instant ('ta' = instant in which the clocks in London marked 00:00 the day January 1') . We could have chosen another origin: for example, tA=the instant in which the Apollo XI landed on the moon. You'll agree that if I define this new epoch: "milliseconds since that instant 'tA' till now", you and I will get the same number (at the same instant) and it would not have anything to do with our timezones.
Upvotes: 7