all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#311: parse-time-string fails on non-abbre month str
@ 2008-05-23 22:32 xah lee
  0 siblings, 0 replies; only message in thread
From: xah lee @ 2008-05-23 22:32 UTC (permalink / raw)
  To: emacs-pretest-bug


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


☄










^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-23 22:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-23 22:32 bug#311: parse-time-string fails on non-abbre month str xah lee

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.