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

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

Re: how do you compute date difference in emacs?


From: José A . Romero L .
Subject: Re: how do you compute date difference in emacs?
Date: Tue, 04 May 2010 15:44:49 -0000
User-agent: G2/1.0

On 16 Kwi, 20:23, Xah Lee <xah...@gmail.com> wrote:
> computing dates.
>
> Recently i needed to compute dates in emacs.
>
> For example, i need to find out:
> 2010-04-16 - 215 days.
(...)

Something like this should do the job:

(format-time-string
 "%Y-%m-%d"
 (time-subtract (date-to-time "2010-04-16 00:00") (days-to-time 215)))

Notice that you *must* specify at least hour and minute (e.g. 00:00)
in order
for the date string to be parseable.

Have a look at time-date.el for some useful time-related functions.

Cheers,
--
José A. Romero L.
escherdragon at gmail
"We who cut mere stones must always be envisioning cathedrals."
(Quarry worker's creed)



reply via email to

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