[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: parsing time stamp
From: |
Kevin Rodgers |
Subject: |
Re: parsing time stamp |
Date: |
Thu, 22 May 2008 22:17:49 -0600 |
User-agent: |
Thunderbird 2.0.0.14 (Macintosh/20080421) |
Johan Bockgård wrote:
Xah <xahlee@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