all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tim Landscheidt <tim@tim-landscheidt.de>
To: Bruno Barbier <brubar.cs@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Counterpart to time-to-days?
Date: Thu, 30 May 2019 13:52:15 +0000	[thread overview]
Message-ID: <87woi8yrqo.fsf@passepartout.tim-landscheidt.de> (raw)
In-Reply-To: <5ceee589.1c69fb81.2145e.33c3@mx.google.com> (Bruno Barbier's message of "Wed, 29 May 2019 23:03:04 +0200")

Bruno Barbier <brubar.cs@gmail.com> wrote:

>> | 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

Thanks, that works.  (Now on for some time zone mangling …)

Tim



      reply	other threads:[~2019-05-30 13:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29 12:20 Counterpart to time-to-days? Tim Landscheidt
2019-05-29 21:03 ` Bruno Barbier
2019-05-30 13:52   ` Tim Landscheidt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87woi8yrqo.fsf@passepartout.tim-landscheidt.de \
    --to=tim@tim-landscheidt.de \
    --cc=brubar.cs@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.