From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Jos=E9_A=2E_Romero_L=2E?= Newsgroups: gmane.emacs.help Subject: Re: how do you compute date difference in emacs? Date: Fri, 16 Apr 2010 13:50:21 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1273007746 13903 80.91.229.12 (4 May 2010 21:15:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 4 May 2010 21:15:46 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 04 23:15:45 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O9PSz-0008M5-Ac for geh-help-gnu-emacs@m.gmane.org; Tue, 04 May 2010 23:15:45 +0200 Original-Received: from localhost ([127.0.0.1]:51354 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9PSy-0000bb-Jd for geh-help-gnu-emacs@m.gmane.org; Tue, 04 May 2010 17:15:44 -0400 Original-Path: usenet.stanford.edu!postnews.google.com!j21g2000yqh.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs Original-Lines: 28 Original-NNTP-Posting-Host: 89.78.68.41 Original-X-Trace: posting.google.com 1271451021 2105 127.0.0.1 (16 Apr 2010 20:50:21 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 16 Apr 2010 20:50:21 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j21g2000yqh.googlegroups.com; posting-host=89.78.68.41; posting-account=mkEKGAoAAACAV2vhv5r9WHXWqsdL_niD User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3,gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:177727 comp.emacs:99746 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:73175 Archived-At: On 16 Kwi, 20:23, Xah Lee 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=E9 A. Romero L. escherdragon at gmail "We who cut mere stones must always be envisioning cathedrals." (Quarry worker's creed)