From: Bastien <bastien.guerry@wikimedia.fr>
To: Inquisitive Scientist <inquisitive.scientist@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: how do you extract schedule duration in column-view
Date: Thu, 12 Aug 2010 19:00:46 +0200 [thread overview]
Message-ID: <877hjv4vgh.fsf@gnu.org> (raw)
In-Reply-To: <AANLkTikohg0B5hmv_htjAVaDEuom=L9nPHR=cpE_Sv=G@mail.gmail.com> (Inquisitive Scientist's message of "Thu, 12 Aug 2010 12:19:36 -0400")
Inquisitive Scientist <inquisitive.scientist@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
prev parent reply other threads:[~2010-08-12 17:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-12 16:04 how do you extract schedule duration in column-view Inquisitive Scientist
2010-08-12 16:19 ` Inquisitive Scientist
2010-08-12 17:00 ` Bastien [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877hjv4vgh.fsf@gnu.org \
--to=bastien.guerry@wikimedia.fr \
--cc=emacs-orgmode@gnu.org \
--cc=inquisitive.scientist@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).