Antony P Joseph on 15 Jul 2007 18:17:33 -0000


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

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


Hi
On Sun, 2007-07-15 at 13:52 -0400, Matthew Rosewarne wrote:

> through a number of online converters and perl scripts, I found a good way to 
> do it with plan old /bin/date:
> 
> date -d "1970-01-01 $TIMESTAMP sec"
> 
> So for example, if you entered:
> 
> 	date -d "1970-01-01 1184521826 sec"
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()"

 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

> 
> you would get:
> 
> 	Sun Jul 15 18:50:26 EDT 2007
> 
> Hopefully someone else will find this useful.

With regards
Antony

___________________________________________________________________________
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