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

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

Re: Counterpart to time-to-days?


From: Bruno Barbier
Subject: Re: Counterpart to time-to-days?
Date: Wed, 29 May 2019 23:03:04 +0200

Hi,

Tim Landscheidt <tim@tim-landscheidt.de> writes:

> Hi,
>
...

> | ELISP> (format-time-string "%F" (current-time))
> | "2019-05-29"
> | ELISP> (format-time-string "%F" (days-to-time (time-to-days 
> (current-time))))
> | "3988-05-29"
> | ELISP>
>
> So time-to-days seems to count the days from 0001-12-31bce,
> while days-to-time (without being explicit about it) seems
> to treat days as counting from epoch (1970-01-01).
>
> What is the intended counterpart to time-to-days?

Are you looking for `time-to-number-of-days` ?

   (format-time-string "%F" (days-to-time (time-to-number-of-days 
(current-time))))
   => 2019-05-29
      

Bruno

> How is date arithmetic supposed to be done in Emacs Lisp?

>
> TIA,
> Tim



reply via email to

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