How to Convert a Linux Epoch Timestamp to Date on the Command Line

6

Epoch timestamp is the time exceeded since January 1, 1970 at 00:00:00 UTC in seconds. These timestamps are often utilized in computing and are notably beneficial for handling dates and occasions in an average and steady method. Reading and deciphering these timestamps might possibly be tricky for those who find themselves unfamiliar with epoch timestamps. Please learn this instruction when you additionally need to know convert a Linux epoch timestamp so far on the command line.

How to Convert a Linux Epoch Timestamp to Date on the Command Line

The date command is an average Unix utility that shows and manipulates the dates and occasions. It is the pre-installed utility in most Linux distributions and might convert an epoch timestamp to a human-readable date and time. Run the subsequent command to transform an epoch timestamp:

In the prior command, you’ll be able to change the because the wide variety of seconds since January 1, 1970 at 00:00:00 UTC.

For instance, to transform the epoch timestamp 1674000000 which corresponds to January 18, 2023 at 00:00:00 GMT, use the subsequent command:

The -d choice specifies the date and time in a format that’s understood by the date command. The “@” image shows that the argument is an epoch timestamp rather than a completely different time format.

The date command helps a number of completely different output codecs which you’ll be able to specify employing the + choice and a format string. For instance, to reveal the date and time inside the YYYY-MM-DD HH:MM:SS format, use the subsequent command:

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

You can locate greater info on the format codes on the guide date web page (man date).

Conclusion

This is all concerning the ordinary approach to convert a Linux epoch timestamp so far on the command line. This might possibly be beneficial for changing timestamps in log data, database entries, and different information sources into an easier-to-read and comprehensible format. With a ordinary command line argument, you’ll be able to briskly and readily convert an epoch timestamp right into a date and time that’s usable in your functions.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More