Matthew Rosewarne on 15 Jul 2007 18:54:52 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Making sense of UNIX time_t ("epoch seconds")


On Sunday 15 July 2007, Antony P Joseph wrote:
> There is a catch here epoch is in GMT.  While date will look into  local
> time variable. So the correct will be date -d " local epoch  time()"

Right, forgot about timezones...

>  Another easier way is
> $perl -e ' print gmtime(1184521826)."\n"; '
> Sun Jul 15 17:50:26 2007
>  $perl -e ' print "".localtime(1184521826)."\n"; '
> Sun Jul 15 13:50:26 2007

I don't know, call me old fashioned, but I don't find anything to be easier in 
perl. :>

"date" can give the correct output if you tack "UTC" on the end of the 
command, which would look like:

date -d "1970-01-01 $TIMESTAMP sec UTC"

Attachment: signature.asc
Description: This is a digitally signed message part.

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug