12

When I write something like this: <2015-07-05 Sun 20:00 GMT+0>, and then try to edit it by pressing C-c ., Org removes the GMT+0 part. So, I think it's in a wrong format.

Note: I don't want to set my time to a different timezone. I want dates in a particular document to be in that timezone.

  • This sounds like a feature request. – Andrew Swann Jun 26 '15 at 11:51
  • @AndrewSwann oh, I thought there was a way... I think I saw Org dates with a timezone, just couldn't remember where. I'll write to the mailing list then to make sure. – wvxvw Jun 26 '15 at 13:30
  • @AndrewSwann yup, it seems like that's not possible now, and not planned in the near future, so, if you want to, you can make it an answer. – wvxvw Jun 26 '15 at 19:05
  • @wvxvw asked the devs too lists.gnu.org/archive/html/emacs-orgmode/2015-06/msg00644.html – I don't think anything came of it unfortunately :( This would be a nice feature to have for e.g. when you live in a DST time zone, and have a recurring chat with someone in a non-DST time zone. – unhammer May 24 '17 at 11:06
  • (I ended up adding my event twice, using <%%(diary-float '(…) …)> to split up the months into DST vs non-DST) – unhammer May 24 '17 at 11:15
5

Time zone informatian is not currently part of date formats in org-mode and thus not part of the output from C-c .. Like C-c C-c on a timestamp any extraneous material in the date specification is removed and the week day is corrected to fit a given date, so partial junk input like

 13-6-3 Wed Xyz 13:00

is output as

 <2013-06-03 Mon 13:00>

a correct date, with matching day name.

It might be appropriate to make a feature request to the org-mode developers.

  • Customizing org-time-stamp-formats will do part of the trick for every timestamps that orgmode generates and handle. It'll work as long as you want to store your local timezone with any timestamps orgmode generates. See my full answer – vaab Sep 10 '20 at 5:55
2

Note: this only stores the local timezone and keep it in your timestamps. It'll replace any timezone information by your local one. But at least it'll store your current local one.

Note2: all timestamps will work to my knowledge, but time ranges are then ambiguously displayed. Thanks to @He Yifei 何一非 to bring that up.

This is what I did:

  (setq org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M %Z>"))

The important part is the %Z.

default is (from orgmode source):

(defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
  "Formats for `format-time-string' which are used for time stamps.")

With this setting, all instances of timestamps in orgmode that I use and can think of get the timezone information added (ie: <2020-09-15 Tue 09:00 CEST>):

  • modifying dates by hand and using C-c C-c (timezone will get added if missing)
  • Clockin and Clockout with C-c C-x C-i / C-c C-x C-o
  • CLOSED, SCHEDULED, DEADLINE
  • org-time-stamp when inserting time and not only date info

And I didn't notice any issue, except that time ranges are not really useable (I don't use them). I'm using quite extensively all the clock/timestamps. This setting is available in orgmode for a very long time, before 2008 for sure, according to org git repository.

Let me add the fact that you should probably NEVER store naive timestamps (without timezones) anywhere. It is a pity that orgmode does this by default. Thankfully, it is easy to fix.

  • Duration becomes something like this 2020-09-15 Tue 07:00 PDT-07:50 which isn't desirable. Any way to make it e.g., 2020-09-15 Tue 07:00 PDT-07:50 PDT? – He Yifei 何一非 Sep 15 '20 at 3:47
  • Not sure if I'm looking at the right file, but github.com/bzg/org-mode/blob/… seems to suggest that the -HH:MM part is hardcoded. – He Yifei 何一非 Sep 15 '20 at 3:54
  • @HeYifei何一非 Timestamps in my system with this setup are without the ending -HH:MM: here's one for instance: <2020-09-15 Tue 09:00 CEST> (I added this as an example in the answer also). The code you pointed at is about timestamp vs datestamp. What are you calling "duration" ? – vaab Sep 15 '20 at 10:06
  • I was referring to "time range": orgmode.org/manual/The-date_002ftime-prompt.html "You can specify a time range by giving start and end times or by giving a start time and a duration (in HH:MM format). Use one or two dash(es) as the separator in the former case and use ‘+’ as the separator in the latter case," Like when you are entering schedule, type 7:00+0:50 (or 7:00-7:50) and press enter, it gives 2020-09-15 Tue 07:00 PDT-07:50. – He Yifei 何一非 Sep 16 '20 at 11:54
  • 1
    I never used time ranges, and did not know their existences. Thanks for allowing me to learn about them. I edited my answer to add a proper warning. A question arise, wouldn't these should be simply written as 2 timestamps separated by dashes ? Just as clockin/clockout does. It's lengthy but quite readable. I figure this shouldn't be very complicated to implement. Are there a lot of place were time ranges are actually used ? I'll definitively have a look. – vaab Sep 16 '20 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.