From: Jason Rumney <jasonrumney@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: how do you compute date difference in emacs?
Date: Fri, 16 Apr 2010 21:42:38 -0700 (PDT) [thread overview]
Message-ID: <1acb4c85-70bd-4f58-bbb1-b13370eca4c2@c21g2000yqk.googlegroups.com> (raw)
In-Reply-To: c0a692af-79f5-4700-bd1d-807c190b5893@y14g2000yqm.googlegroups.com
On Apr 17, 8:39 am, Xah Lee <xah...@gmail.com> wrote:
> here's some complaints about the emacs solutions in case some emacs
> dev is interested.
>
> The calender mode... so i type Alt+x calendar. Been using it for 10
> years, but mostly only just to look at today's date and day of the
> week.
>
> After Edward's suggestion, i thought yeah why didn't i thought of it,
> cause i knew the emacs calender does all sort of esoteric calender
> systems and thus must contain ways to do simple day substraction. But
> while in calender, am not sure how to use it to computer yyyy-mm-dd
> minus days.
In calendar mode, you can do it interactively.
From the "Goto" menu, you can find "Other date" which has the keyboard
shortcut "g d" (in your example case you don't need this step, since
the date was yesterdays date). Then you can use C-u NUMBER_OF_DAYS
<left> to go back a number of days.
> For Jose Romero's suggestion:
>
> (format-time-string
> "%Y-%m-%d"
> (time-subtract (date-to-time "2010-04-16 00:00") (days-to-time 215)))
>
> this code results in "1999-05-30".
In 23.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.18.3) of 2010-03-16 on
crested, modified by Debian; the code above results in an error,
because the seconds are required in the argument to date-to-time.
next prev parent reply other threads:[~2010-04-17 4:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-16 18:23 how do you compute date difference in emacs? Xah Lee
2010-04-16 20:45 ` Edward M. Reingold
2010-04-16 20:50 ` José A. Romero L.
2010-04-17 0:39 ` Xah Lee
2010-04-17 4:42 ` Jason Rumney [this message]
2010-04-17 7:38 ` Xah Lee
2010-04-17 9:13 ` José A. Romero L.
2010-05-06 23:37 ` Kevin Rodgers
2010-04-17 7:19 ` David Kastrup
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1acb4c85-70bd-4f58-bbb1-b13370eca4c2@c21g2000yqk.googlegroups.com \
--to=jasonrumney@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).