〈Emacs Lisp: Writing a Date Time String Parsing Function〉
http://xahlee.org/emacs/elisp_parse_time.html
On Sep 21, 4:48 am, "Oleksandr Gavenko (gavenkoa)"
<
gave...@bifit.com.ua> wrote:
> 04.09.2011 11:29, Xah Lee пишет:> Write a elisp function. The function will take a string argument that's any of common date time format, e.g.
>
> > Fri, 2 Sep 2011 11:14:11 +0200 (unixy)
>
> > 09/02/2011 (USA)
> > Sep 2, 2011
> > 2 Sep, 2011
> > 2 September, 2011
> Facking USA time format... Why people like it???? STOOOPPP!!!
>
> format-time-string is a built-in function in `C source code'.
> ...
> %b and %h are the locale's abbreviated month name, %B the full name.
>
> So if you use:
>
> (format-time-string "%d %b %Y %H:%M:%S %z" ...)
>
> like this done in
>
>
http://bazaar.launchpad.net/~hexmode/weblogger-el/trunk/view/head:/we...
>
> you can not parse back by 'parse-time-string' as month name is 'Март'.
>
>
>
> > and output a canonical form 2011-09-02.
>
> This time specification come from ISO 8601 3ed:
>
> (parse-time-string "1985-04-12T10:15:30+04:00") ; fail
> (parse-time-string "19850412T101530+0400") ; fail
>
> Emacs understand only (space instead 'T', no timezone):
>
> (parse-time-string "1985-04-12 10:15:30") ; OK
as far as i know, using space instead of T is not part of the ISO 8601
standard. Or did they change?
i know that there are standards based on ISO 8601 that allows space. I
think it's part of some XML. Anyone know which standard is it?
Xah