[ILUG] Seconds to date?
P at draigBrady.com
P at draigBrady.com
Thu Jun 5 10:06:44 IST 2003
John Gaughan wrote:
> On Sat, 31 Aug 2002, Conor Daly wrote:
>
>>On Fri, Aug 30, 2002 at 12:33:47PM +0100 or so it is rumoured hereabouts,
>>kevin lyda thought:
>>
>>>On Fri, Aug 30, 2002 at 12:23:10PM +0000, Conor Daly wrote:
>>>
>>>>takes 2002/7/1 and outputs 1025481600
>>>>
>>>>Can anyone tell me what will do the inverse?
>>>
>>>just barely a perl one-liner:
>>>
>>>perl -e 'use POSIX strftime;print(strftime("%Y/%m/%d\n",localtime(1025481600)))'
>>
>>Thanks guys, A nice selection to work with. Unfortunatels FreeBSD's
>>"date -r" doesn't exist in GNU date!
>
> You can do it with GNU date like this:
> date -d '1970-01-01 1025481600 sec' +%Y/%m/%d
<jamaican accent>
I'm 23,970,754 seconds late
</jamaican accent>
but there is a UTC missing above, it should be:
date --date='1970-01-01 UTC 1025481600 sec' "+%Y/%m/%d"
Pádraig
More information about the ILUG
mailing list