[nSLUG] Re: The tide turned in Armdale Cove...

Mike Spencer mspencer at tallships.ca
Thu Aug 28 21:28:25 ADT 2008


me> Is there a straightforward, preferably command-line, way to
me> convert one of the standard date formats produced by /bin/date
me> (say, "Thu Aug 28 13:07:54 ADT 2008") to the canonical <seconds
me> since 1970-01-01 00:00:00 UTC> format?

a.spanik> aspanik at slappy:~> date -d "Thu Aug 28 13:07:54 ADT 2008" +%s
a.spanik> 1219939674

Duh!  There it is, practically the first line of the manpage options.
That appears to do exactly what I want.  I don't know how many times
I've looked at that and simply misread it or somehow not read it at
all.  Cringe.  Blush.  Thanks.

a.spanik> Hope I didn't misunderstand something there, but I think
a.spanik> that's what you're looking for.

Yes, it is.

ian> ian at shadow:~$ date -d @1219939674
ian> Thu Aug 28 13:07:54 ADT 2008

Hmmm.  Cool.  Doesn't work on my Slack 10.1 distro, date-5.2.1. Ah,
well, slack 12 is sitting here on a USB HD, while I wait for a cable.

a.spanik> It's not in "man date", but it's in "info date"....

Ah, well!  No mention of the @epochal-seconds syntax in my version.
However, "info coreutils date" has something more that I've missed as
well: 

     Our units of temporal measurement, from seconds on up to months,
     are so complicated, asymmetrical and disjunctive so as to make
     coherent mental reckoning in time all but impossible.  Indeed,
     had some tyrannical god contrived to enslave our minds to time,
     to make it all but impossible for us to escape subjection to
     sodden routines and unpleasant surprises, he could hardly have
     done better than handing down our present system.

...and more, attrib. to  Robert Grudin, `Time and the Art of Living'.

Indeed so.  I made a script to fetch current satellite weather images
from the CanGov site where the filenames are date- &
time-based. Figuring out how compose the filename for the most recent
image prior to present time, allowing for possible backup into
previous day, month and year and for AST/DST roll-over was a pain and
still fails once in, oh, 50 or so tries.

Thanks for the pointers, help and -- heh -- humiliation. :-)

- Mike

-- 
Michael Spencer                  Nova Scotia, Canada       .~. 
                                                           /V\ 
mspencer at tallships.ca                                     /( )\
http://home.tallships.ca/mspencer/                        ^^-^^



More information about the nSLUG mailing list