Linux / UNIX: Convert Epoch Seconds To the Current Time

Linux / UNIX: Convert Epoch Seconds To the Current Time

To convert epoch seconds (the number of seconds since January 1, 1970) to the current time on a Linux or UNIX system, you can use the date command.

For example, to convert the epoch seconds 1623490000 to the current time, you can use the following command:

r‮t refe‬o:lautturi.com
date -d @1623490000

This will output the current date and time in the following format:

Fri Mar 18 14:50:00 UTC 2022

You can also use the -u option to output the date and time in Universal Time (UTC) rather than the local time:

date -u -d @1623490000

You can use the -R option to output the date and time in the HTTP-compatible RFC 2822 format:

date -R -d @1623490000

This will output the date and time in the following format:

Fri, 18 Mar 2022 14:50:00 +0000

You can use the -I option to output the date and time in the ISO 8601 format:

date -I -d @1623490000

This will output the date and time in the following format:

2022-03-18T14:50:00+00:00

You can use the --rfc-3339=seconds option to output the date.

Created Time:2017-10-16 14:38:52  Author:lautturi