Inquisitive Scientist <inquisitive.scient...@gmail.com> 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

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to