Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Command date +%s produces 1403568422. Is there an easy way to convert the 1403568422 to a human readable UTC timestamp?

python -c "import datetime;print datetime.datetime.utcfromtimestamp(1403568422).isoformat()" kind of works; I can also write a short C program to do the same thing. Is there a better way?


I do not want to make date print the current time in UTC. I want date (or other utility) to convert a given number of seconds since UTC - say 1403568422 - to a human readable format.

Background: I have these timestamps in a file and I wanted to know when exactly the things happened.

share|improve this question
There are so many web pages giving you this answer... date +%Y-%m-%d_%H:%M:%S Please have a look around before you keep repeating the same questions. There's also something called man date or info date – Jakke Jun 24 '14 at 0:29
Uh, date can print whatever time you want it to. From man date: -d, --date=STRING display time described by STRING, not 'now'. Huh, there's even an example in the man page dealing with exactly this conversion. – muru Jun 24 '14 at 1:26
Fair enough, thanks for pointing to the example. Although that is the only place where @ is mentioned. – sмurf Jun 24 '14 at 2:01
up vote 7 down vote accepted

I think you're looking for this,

date -d @$(date +%s) +"%Y-%m-%d %H:%M:%S"

It changes the seconds since 1970-01-01 00:00:00 UTC to a human-readable string.


$ date -d @$(date +%s) +"%Y-%m-%d %H:%M:%S"
2014-06-24 06:06:54


share|improve this answer
date -d @1403568422 +"%Y-%m-%d %H:%M:%S" was what I was looking for. Thanks. – sмurf Jun 24 '14 at 1:59

You can simply use date -d @seconds :

date -d @1403568422 :

$ date -d @1403568422 
Mon Jun 23 19:07:02 CDT 2014
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.