[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] Re: how do you extract schedule duration in column-view
From: |
Bastien |
Subject: |
Re: [Orgmode] Re: how do you extract schedule duration in column-view |
Date: |
Thu, 12 Aug 2010 19:00:46 +0200 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux) |
Inquisitive Scientist <address@hidden> 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 "\\<SCHEDULED: *<\\([^>]+\\)
\\([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