How to convert seconds since the epoch to a date in Linux?

How to convert seconds since the epoch (1970-01-01 UTC) to a date in Linux?

For example,

Convert the time stamp 1349361711.169942 to

Thu Oct  4 22:41:51 HKT 2012
asked Nov 4, 2013 by anonymous

1 Answer

 
Best answer

You can use the date command on Linux to convert the time formats.

For converting the time stamp 1349361711.169942 to the normal data format:

$ date -d @1349361711.169942 
Thu Oct  4 22:41:51 HKT 2012

You can control the format of the output by add +FORMAT at the end of the command. For detailed introduction to the FORMAT string, check the manual of date.

answered Nov 4, 2013 by anonymous

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...