From mboxrd@z Thu Jan 1 00:00:00 1970 From: thunk2@arcor.de (Thomas Plass) Subject: Re: parsing time strings from properties Date: Sun, 22 Sep 2019 12:10:46 +0200 Message-ID: <23943.18598.271616.396497@AGAME7.local> References: Reply-To: Thomas Plass Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:41256) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBypc-0005rC-II for emacs-orgmode@gnu.org; Sun, 22 Sep 2019 06:11:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBypb-0007WI-BT for emacs-orgmode@gnu.org; Sun, 22 Sep 2019 06:11:04 -0400 Received: from mx009.vodafonemail.xion.oxcs.net ([153.92.174.39]:42070) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBypb-0007Uw-5L for emacs-orgmode@gnu.org; Sun, 22 Sep 2019 06:11:03 -0400 In-Reply-To: Your message of Saturday, September 21 2019 16:27:33 (ID: ). List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Matt Price Cc: Org Mode Hi, Matt Price wrote at 16:27 on September 21, 2019: :=20 : :DUE=5FAT: 2019-09-26 :=20 : ... : : I'm wondering though how hard : it would be to get the current time zone -- or the time zone that the= course is taught in -- from : emacs, and construct the string from that value.=A0 This'll return the offset suffix (if that's what you want) when executed in your local time zone (presumably "-04:00"): (defun Price/local-time-offset-from-iso-date (y-m-d) (let* ((ymd (mapcar (lambda (s) (string-to-number s)) (split-string y= -m-d "-"))) (offsecs (nth 8 (decode-time (apply #'encode-time (list 59 59 23 (nth 2 ymd) (nth 1 ymd) (= nth 0 ymd))))))) (format "%s%02d:%02d" (if (> offsecs 0) "+" "-") (/ offsecs 3600) (% offsecs 3600)))) On Unix, this'll always work. On Windows, it works most of the time, but may fail in the weeks around switches from and to daylight saving. Thomas