[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
parse-time-string fails on non-abbre month str
From: |
xah lee |
Subject: |
parse-time-string fails on non-abbre month str |
Date: |
Fri, 23 May 2008 15:32:45 -0700 |
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
address@hidden
∑ http://xahlee.org/
☄
Newsgroups: gnu.emacs.help
From: Kevin Rodgers <address@hidden>
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 <address@hidden> 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
☄
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- parse-time-string fails on non-abbre month str,
xah lee <=