Server Fault is a question and answer site for system and network administrators. 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

I wrote a code which convert epoch time to readable time

sd=`date -d '1970-01-01 UTC '$SDATE' seconds' +"%d-%m-%Y"`

the output is : 27-12-2002 but I want the output to be : 27/Nov/2002

how should i change my code?

share|improve this question
up vote 3 down vote accepted

sd=`date -d '1970-01-01 UTC '$SDATE' seconds' +"%d/%b/%Y"

I believe

share|improve this answer

There's a shortcut for "time from unix stamp": date -d @$STAMP. For the output, read man date

share|improve this answer

Use %b instead:

sd=`date -d '1970-01-01 UTC '$SDATE' seconds' +"%d/%b/%Y"`

Read man date for more details:

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.