"Nelson H. F. Beebe" <[EMAIL PROTECTED]> wrote:
> Also, it would be helpful if GNU date (also part of coreutils) could
> input and output time values since the epoch given on the command
> line, since that would make time conversions easy. I know there is a
> perl module to do that, and GNU gawk can do it like this:
>
> % gawk 'BEGIN{print strftime("%c", 941742458)}'
> Thu Nov 4 12:07:38 1999
>
> Still, date is the obvious tool to provide such conversions. As far
> as I can tell, GNU date provides one of the needed conversions:
>
> % date '+%s'
> 1075736647
>
> but not the other
>
> % date -d 1075736647
> date: invalid date `1075736647'
Here's an example in `info date example'
To convert such an unwieldy number of seconds back to a more
readable form, use a command like this:
# local time zone used
date -d '1970-01-01 UTC 946684800 seconds' +"%Y-%m-%d %T %z"
1999-12-31 19:00:00 -0500
Often it is better to output UTC-relative date and time:
date -u -d '1970-01-01 946684800 seconds' +"%Y-%m-%d %T %z"
2000-01-01 00:00:00 +0000
_______________________________________________
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-coreutils