all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: xah lee <xah@xahlee.org>
To: emacs-pretest-bug@gnu.org
Subject: bug#311: parse-time-string fails on non-abbre month str
Date: Fri, 23 May 2008 15:32:45 -0700	[thread overview]
Message-ID: <30A8BF5C-90C7-4C31-9025-AFE5643CCCA6__46104.9294718125$1211596394$gmane$org@xahlee.org> (raw)


This fails in getting the month string.
(parse-time-string "August 5, 2002.")

Kevin Rodgers also reported in gnu.emacs.help yesterday that it fails  
in getting full weekday names, and he provide a fix for that. (his  
message and code pasted below my sig)

   Xah
   xah@xahlee.org
∑ http://xahlee.org/

☄

Newsgroups: gnu.emacs.help
From: Kevin Rodgers <kevin.d.rodg...@gmail.com>
Date: Thu, 22 May 2008 22:17:49 -0600
Local: Thurs, May 22 2008 9:17 pm
Subject: Re: parsing time stamp

Johan Bockgård wrote:
 > Xah <xah...@gmail.com> writes:
 >> is there a function that parses a timestamp like “Monday, Nov. 28,
 >> 1994” so that i can write a function to turn it into the format  
yyyy-
 >> mm-dd?
 > parse-time-string


(parse-time-string "Monday, Nov. 28, 1994")
=> (nil nil nil 28 11 1994 nil nil nil)
Odd that the leading "Monday, " yields nil DOW...  It turns out that is
due to the fact that the parse-time-weekdays variable only has
abbreviations (e.g. "mon"), just like parse-time-months.  Easy to fix:
(let ((parse-time-weekdays (append parse-time-weekdays
                                    '(("sunday" . 0)
                                      ("monday" . 1)
                                      ("tuesday" . 2)
                                      ("wednesday" . 3)
                                      ("thursday" . 4)
                                      ("friday" . 5)
                                      ("saturday" . 6)))))
    (parse-time-string "Monday, Nov. 28, 1994"))
=> (nil nil nil 28 11 1994 1 nil nil)
-- 
Kevin Rodgers
Denver, Colorado, USA


☄










                 reply	other threads:[~2008-05-23 22:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='30A8BF5C-90C7-4C31-9025-AFE5643CCCA6__46104.9294718125$1211596394$gmane$org@xahlee.org' \
    --to=xah@xahlee.org \
    --cc=311@emacsbugs.donarmstrong.com \
    --cc=emacs-pretest-bug@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.