Java Timestamp vs Unix Timestamp

Java Timestamp vs Unix Timestamp

Unix timestamp is the number of seconds that have elapsed since midnight of January 1st 1970.

To display unix timestamp in shell type:

date +%s

Sample output is a ten digit number:

1385726996

 

Java timestamp is the number of milliseconds that have elapsed since midnight of January 1st 1970 (thirteen digit number).

 

To display unix timestamp in Java you can divide Java timestamp value by 1000:

 


See also: Wikipedia – Year 2038 problem


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.