From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Chris Randle" Subject: Date arithmetic in tables Date: Tue, 29 Apr 2008 13:29:10 +0100 Message-ID: <00be01c8a9f4$a310ca00$6580a8c0@CUBE> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jqoxj-000147-LX for emacs-orgmode@gnu.org; Tue, 29 Apr 2008 08:29:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jqoxi-00013o-58 for emacs-orgmode@gnu.org; Tue, 29 Apr 2008 08:29:35 -0400 Received: from [199.232.76.173] (port=59709 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jqoxi-00013j-1H for emacs-orgmode@gnu.org; Tue, 29 Apr 2008 08:29:34 -0400 Received: from anchor-post-34.mail.demon.net ([194.217.242.92]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jqoxh-0004zo-Js for emacs-orgmode@gnu.org; Tue, 29 Apr 2008 08:29:33 -0400 Received: from amlog.demon.co.uk ([80.177.106.135] helo=CUBE) by anchor-post-34.mail.demon.net with esmtp (Exim 4.67) id 1JqoxZ-000CCo-F1 for emacs-orgmode@gnu.org; Tue, 29 Apr 2008 12:29:25 +0000 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi All This post started as a problem and question, but I found a solution. I thought I'd document my observations. Forgive me if it's obvious, but it wasn't to me! I had trouble with date arithmetic in an org table, I think because the function thought that inactive dates were vectors: | Date | Days before today | |------------------+---------------------------------------------------- ----| | <2008-03-22 Sat> | 38.540 | | [2008-03-22 Sat] | [<2002-11-24 Sun 12:57>, <2008-04-29 Tue 12:57> - Sat] | #+TBLFM: $2=now()-$1 I didn't want to use active dates, as I didn't want the heading to appear in the agenda. Starting to play around, I discovered that <[2008-03-22 Sat]> would work as an inactive date acceptable to the formula, but the trailing ">" was stripped when using keystrokes to adjust the date. So then I noticed that <[2008-03-22 Sat] would work still, and nothing was lost during adjustment. Which finally led to the discovery that [2008-03-22 Sat] also works if the formula is adjusted to #+TBLFM: $2=now()-<$1> Hope this helps others. -- Chris Randle Org-mode 6.02. Emacs 22.1.1. Windows XP.