bug-sh-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: date


From: Bob Proulx
Subject: Re: date
Date: Thu, 7 Mar 2002 21:27:13 -0700

JR

> is it possible with date to set the time it shall display with the number
> of seconds, one gets from the output of:
> 
> '  %s   seconds since 00:00:00, Jan 1, 1970 (a GNU extension)'

Yes it is possible.  This is documented in the manual.  Here is the
pertinent section.

     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

Bob

> If not I would suggest to implement this possibility, because it could be
> quite practical for use in shell sctips.
> 
> The reason is as follows: In one of my scripts I use 'date +%s' as time
> step as part of a identification number and I would later be able to
> display the date of the identification again.
> 
> As far as I see, date does not accept the single number, so one could use
> this free function like:
> 
> date 1006589268
> 
> with best regards
> 
> JR



reply via email to

[Prev in Thread] Current Thread [Next in Thread]