[RndTbl] Convert time in seconds to date in bash?

Gilles Detillieux grdetil at scrc.umanitoba.ca
Tue Dec 7 10:36:30 CST 2004

Cool.  I had to do this just last week.  After wasting half an hour
digging through man pages and Google searches, I gave up and wrote a q&d
C program.  It seems there ought to be a way to do this with "date -d",
but I can't find a way to get it to take seconds since epoch as an input.
For that matter, I can't figure out how to get it to output the date as
such either.

According to Sean A. Walberg:
> Been trying to do this one for ages... Best I can come up with uses a perl 
> one liner:
> perl -e 'print scalar localtime 1102434671'
> Sean
> On Tue, 7 Dec 2004, Kevin McGregor wrote:
> > Does anyone know of a quick way to convert the Unix time (in seconds
> > since Jan 1, 1970) to a readable date via bash and standard commands?

Gilles R. Detillieux              E-mail: <grdetil at scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/
Dept. Physiology, U. of Manitoba  Winnipeg, MB  R3E 3J7  (Canada)

More information about the Roundtable mailing list