Converting from or to Unix timestamps

Unix timestamps (sometimes also called epoch) encode date and time in a single number, counting the seconds since January 1, 1970, 00:00 (UTC). The format is used througout a lot of software, but how can it be decoded to our common format?

Naturally, there are web services like Epoch Converter, but how to decode it using the common GNU command line tools? Here’s a short summary:

Epoch -> Human time:

date -d @1234567890

Human time -> Epoch:

date -d "2010-10-20 20:10" +%s

Current time (in human format and in epoch):

date +%s

Find out more about date formatting using

man date

Leave a Reply

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