From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Re: how do you extract schedule duration in column-view Date: Thu, 12 Aug 2010 19:00:46 +0200 Message-ID: <877hjv4vgh.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Return-path: Received: from [140.186.70.92] (port=48400 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ojb99-00059g-8k for emacs-orgmode@gnu.org; Thu, 12 Aug 2010 13:00:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ojb97-0002yM-40 for emacs-orgmode@gnu.org; Thu, 12 Aug 2010 13:00:51 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:44664) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ojb96-0002y7-Uu for emacs-orgmode@gnu.org; Thu, 12 Aug 2010 13:00:49 -0400 Received: by wwi14 with SMTP id 14so347817wwi.30 for ; Thu, 12 Aug 2010 10:00:47 -0700 (PDT) In-Reply-To: (Inquisitive Scientist's message of "Thu, 12 Aug 2010 12:19:36 -0400") 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: Inquisitive Scientist Cc: emacs-orgmode@gnu.org Inquisitive Scientist writes: > Actually, I can almost figure out how to do this myself if I knew what function > to use to convert a string like > >          SCHEDULED: <2010-08-12 Thu 10:20-10:45> > > into a duration. If I call org-time-string it only gives me the first part of > the date and ignores the ending point. > > Any tips on what org-mode function to use to get the duration of a scheduled > time? Try this function on the scheduled timestamp: ,---- | (defun bzg-duration-of-timestamp-at-point () | "Compute the duration of the timestamp at point." | (interactive) | (save-excursion | (forward-line 0) | (when (re-search-forward "\\]+\\) \\([0-9]+:[0-9]+\\)--?\\([0-9]+:[0-9]+\\)>" nil t) | (let ((date (match-string 1)) | (t1 (match-string 2)) | (t2 (match-string 3))) | (- (org-time-string-to-seconds (concat date " " t2)) | (org-time-string-to-seconds (concat date " " t1))))))) `---- HTH, -- Bastien