help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parsing a date


From: Eric Abrahamsen
Subject: Re: parsing a date
Date: Fri, 28 Sep 2012 14:11:19 +0800
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (gnu/linux)

On Fri, Sep 28 2012, Óscar Fuentes wrote:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>>>> Which is not acceptable to `encode-time', because it requires integers,
>>>> not nil. I can't believe this is quite this complicated: do I really
>>>> have to replace all the nils with 0 myself?
>>>
>>> (mapcar (lambda (x) (if x x 0)) (parse-time-string "2011-11-15"))
>>
>> Sure, it's doable, but it just seems odd that `parse-time-string'
>> returns a structure that `encode-time' can't read!
>
> I guess that the designers chose to differenciate among `zero' and `not
> specified' on the output of parse-time-string.
>
> As for `encode-time', it takes each date-time component as an argument,
> not the output of parse-time-string, which is a list. OTOH,
> `encode-time' could interpret arguments with value `nil' as `zero'.

I'm also heard of something like this in the works:

(read-time-string "%Y-%m-%d" "2011-11-15")

Where you inform emacs of the format of your incoming strings -- that
seems like it would be more than enough for the sort of thing I'm doing.

E

-- 
GNU Emacs 24.2.50.1 (i686-pc-linux-gnu, GTK+ Version 3.4.4)
 of 2012-09-28 on pellet




reply via email to

[Prev in Thread] Current Thread [Next in Thread]