How to convert Linux timestamps to date format?

In Linux, you can use the date command to convert a timestamp to a date format. The specific command is as follows:

date -d @<timestamp> "+%Y-%m-%d %H:%M:%S"

is the time stamp to be converted, representing the number of seconds that have passed since January 1st, 1970, 00:00:00.

For example, to convert the timestamp 1564987554 to a date format, you can use the following command:

date -d @1564987554 "+%Y-%m-%d %H:%M:%S"

The output is:

2019-08-05 09:25:54

The output date format can be adjusted as needed, with specific format options available in the manual page of the date command.

Leave a Reply 0

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


广告
Closing in 10 seconds
bannerAds