[sf-lug] unix time conversion

Charles-Henri Gros chgros at coverity.com
Mon Oct 27 15:09:36 PDT 2008


Alex Kleider wrote:
> --- On Mon, 10/27/08, Asheesh Laroia <asheesh at asheesh.org> wrote:
>> Note that 1969 (well, 1970, but 1969 in US timezones) and
>> 2038 are 
>> respectively the beginning and the end of time_t 
>> <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.
> date -d'-893400000'
> doesn't work on my system.
> 
> perl -e “require ‘ctime.pl’; print &ctime($EPOCH);”
> was suggested in one of the links but I've no idea where to stick the negative number.

Replace $EPOCH with it

> perl -e "require 'ctime.pl'; print &ctime(-893400000);"
Tue Sep  9  9:20:00 1941

> can python do this for us?

Certainly

> echo 'import time; print time.ctime(-893400000);' | python
Tue Sep  9 09:20:00 1941

-- 
Charles-Henri




More information about the sf-lug mailing list