[sf-lug] Unix time conversion

Michael Paoli Michael.Paoli at cal.berkeley.edu
Wed Oct 29 20:32:16 PDT 2008


> Date: Mon, 27 Oct 2008 14:42:25 -0700 (PDT)
> From: Alex Kleider <a_kleider at yahoo.com>
> Subject: [sf-lug] unix time conversion
> To: Linux userGroup <sf-lug at linuxmafia.com>
>
> --- On Mon, 10/27/08, Asheesh Laroia <asheesh at asheesh.org> wrote:
>> <http://en.wikipedia.org/wiki/Unix_time>.
>> -- Asheesh.
>
> I followed up on your wiki reference and would like to know how to
> convert Unix time -893,400,000 into a date I can understand.

$ perl -e 'print(localtime(-893400000) . "\n");'
Tue Sep  9 09:20:00 1941
$
Whether or not the above works may depend on one's vintage of *nix,
perl, and the timezone data one's using.

> Date: Mon, 27 Oct 2008 15:46:04 -0700 (PDT)
> From: Alex Kleider <a_kleider at yahoo.com>
> Subject: Re: [sf-lug] unix time conversion
> To: Linux userGroup <sf-lug at linuxmafia.com>
>
> Now that you have wetted my appetite:   How to change a human  
> readable time into 'unix time?'

$ date -Iseconds
2008-10-29T01:11:41-0700
$ iso2epoch 2008-10-29T01:11:41-0700
1225267901
$  perl -e 'print(localtime(1225267901) . "\n");'
Wed Oct 29 01:11:41 2008
$
iso2epoch is a perl utility I whipped up about two months ago
http://www.rawbw.com/~mp/perl/#iso2epoch
http://www.rawbw.com/~mp/perl/iso2epoch.tar.gz





More information about the sf-lug mailing list