wufoo
wufoo

Reputation: 14571

Java calendar.getTimeInMillis() returns extra zeros?

I am using a Java Calendar object to set a date and then get the time in milliseconds in order to determine chronology of two different epochs. Seemed to be a great plan until I went to double-check the returned value from getTimeInMillis().
Fri Jul 17 00:00:00 CDT 2009 returns 1247806800000 which doesn't seem to jive when I test the returned value with Perl which tells me this epoch should really be 1247806800 (short 3 zeros).

Where are these extra zeros coming from? The Java docs just say getTimeInMillis()

Returns this Calendar's time value in milliseconds.

but doesn't explain why the discrepancy.

Upvotes: 0

Views: 239

Answers (1)

Mikhail Vladimirov
Mikhail Vladimirov

Reputation: 13890

Perl represents time in seconds since epoch, while Java represents it in milliseconds (1/1000 of second) since epoch. So Perl time is always 1000-times less then Java time.

Upvotes: 6

Related Questions