Date and timestamp conversion
Adam Gibson
static at xstatica.com
Thu Apr 20 03:42:47 UTC 2006
Steffen Kluge wrote:
> On Wed, 2006-04-19 at 13:53 +0100, Paul Howarth wrote:
>> Back again:
>> $ TIMESTAMP=1145448136
>> $ awk 'BEGIN { print strftime("%a, %d %b %Y %H:%M:%S %z", '$TIMESTAMP')
>> }' < /dev/null
>> Wed, 19 Apr 2006 13:02:16 +0100
>
> Here's my shorthand for this:
>
> $ perl -e "print scalar localtime $TIMESTAMP"
>
Or by just using date for both directions:
[static at localhost ~]$ date -d "@1145448136"
Wed Apr 19 08:02:16 EDT 2006
[static at localhost ~]$ date -d "Wed Apr 19 08:02:16 EDT 2006" "+%s"
1145448136
> Cheers
> Steffen
>
>
More information about the fedora-list
mailing list