emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [proposal] timezone-aware timestamps enhancement


From: Randomcoder
Subject: Re: [O] [proposal] timezone-aware timestamps enhancement
Date: Fri, 20 Mar 2015 11:40:09 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Mar 18, 2015 at 02:09:31PM -0400, Ken Mankoff wrote:
> I have a solution that works quite well outside of Org. Apple Calendar
> supports timezones plus a "floating" option.  I use Org for all my
> floating events - local to the computer and me, whatever TZ we're in. I
> haven't found a way to put TZ-specific events into Org.
> 
> If scheduling a Skype with someone in NZ, I enter it in iCal at the NZ
> time in the NZ timezone. Org pulls in my iCal events. Then wherever I
> am when that event happens, I get the alert at the correct time. Most
> things are local to me, so I use "floating" and stay in Org.

I wrote a silly elisp function that does the conversion for me.  Hah,
yeah ! exactly, I use it for the exact same thing, scheduling an interview
with someone on the other side of the planet.

So for example they ask me 

"Can you provide us with times when you're available for an interview ?"
and I just make a table and let them decide when:

    | time Tokyo         | time Sofia             |
    |--------------------+------------------------|
    | <2015-03-20 18:00> | <2015-03-20 Fri 11:00> |
    | <2015-03-21 14:00> | <2015-03-21 Sat 07:00> |
    | <2015-03-22 14:00> | <2015-03-22 Sun 07:00> |
    | <2015-03-23 14:00> | <2015-03-23 Mon 07:00> |
    | <2015-03-24 14:00> | <2015-03-24 Tue 07:00> |
    #+TBLFM: $1='(concat "<" (org-tz-conv $2 "Asia/Tokyo" "to") ">")

You said above you're using iCal (do you mean, Google Calendar or
Apple Calendar?). I'd be interested in setting this up as well, which one
should I be using ?

At this point in time I'm using Org-Mode's agenda to view events.
Should I try to sync them up with my phone and if so what is the recommended
way to go ?



This is the implementation of org-tz-conv:

    (defun org-tz-conv (stamp tz way)
      (let* (
             (current-tz-offset (shell-command-to-string "date +%z"))
             (stamp1    (concat (replace-regexp-in-string "[<>]" "" stamp) " " 
current-tz-offset))
             (date-cmd-p0  "TZ=%s date -d \"%s\"")
             (date-cmd-p1  "date --date=\"TZ=\\\"%s\\\" %s\"")
             (date-cmd-p2  " +\"%F %H:%M\"")
             (date-cmd-rendered1  (format date-cmd-p1 tz stamp1 ))
             (date-cmd-from  (concat date-cmd-rendered1 date-cmd-p2))
             (date-cmd-to    (concat (format date-cmd-p0 tz stamp1) 
date-cmd-p2))
             
             (shell-result-from (shell-command-to-string date-cmd-from ))
             (shell-result-to   (shell-command-to-string date-cmd-to   ))

             (result-from (replace-regexp-in-string "\n" "" shell-result-from) )
             (result-to   (replace-regexp-in-string "\n" "" shell-result-to  ) )
             )
        (message shell-result-from)
        (message shell-result-to)
        (cond ((string-equal way "from") result-from)
              ((string-equal way "to"  ) result-to  ))
        ))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]