>
> From:
mspencer@... (Mike Spencer)
> Date: 2008/08/28 Thu PM 12:39:01 EDT
> To:
nslug@...
> Subject: [nSLUG] Re: The tide turned in Armdale Cove...
>
> *snip* lots of non-linux stuffs
> ObLinuxTech: Is there a straightforward, preferably command-line, way
> to convert one of the standard date formats produced by /bin/date
> (say, "Thu Aug 28 13:07:54 ADT 2008") to the canonical <seconds since
> 1970-01-01 00:00:00 UTC> format? Is this what mktime(3) does
> (assuming that you have tediously and explicitly filled in a struct tm
> yourself)? Not the current date, you understand, but any arbitrary
> date string as one might appear in a log file.
You mean like /bin/date?
aspanik@slappy:~> date -d "Thu Aug 28 13:07:54 ADT 2008" +%s
1219939674
/bin/date will take a "-d" option and a STRING, which, according to "man date" can be fairly free-form: /bin/date does it's best to do The Right Thing(tm):
> DATE STRING
> The --date=STRING is a mostly free format human readable date string such
> as "Sun, 29 Feb 2004 16:21:42 -0800" or "2004-02-29 16:21:42" or even "next
> Thursday". A date string may contain items indicating calendar date,
> time of day, time zone, day of week, relative time, relative date, and
> numbers. An empty string indicates the beginning of the day. The date
> string format is more complex than is easily documented here but is fully
> described in the info documentation.
Hope I didn't misunderstand something there, but I think that's what you're looking for.
Cheers,
/a
_______________________________________________
nSLUG mailing list
nSLUG@...
http://nslug.ns.ca/cgi-bin/mailman/listinfo/nslug