bug-coreutils
[Top][All Lists]
Advanced

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

Re: antidote to date +%s not mentioned


From: Jim Meyering
Subject: Re: antidote to date +%s not mentioned
Date: Sat, 14 Jun 2003 10:27:07 +0200

Dan Jacobson <address@hidden> wrote:

> The date command documentation doesn't say how to turn
> $ date +%s
> 1055452108
> back into something readable.

There is an example showing how to do that:

   * If you're sorting or graphing dated data, your raw date values may
     be represented as seconds since the epoch.  But few people can
     look at the date `946684800' and casually note "Oh, that's the
     first second of the year 2000 in Greenwich, England."

          date --date='2000-01-01 UTC' +%s
          946684800

     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

> Please add it to "Pure numbers in date strings::"

But as you can see, the example date string is far from being
a `pure decimal number'.  However, I'd be happy to add a note
there telling how to convert the output of `date +%s' back into
a readable date.  Would you like to write that?




reply via email to

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