From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: org table with datestamp convert to csv and then xlsx or ods: problem Date: Tue, 09 Jan 2018 00:36:11 +0100 Message-ID: <87bmi353f8.fsf@nicolasgoaziou.fr> References: <87373hzk6z.fsf@mat.ucm.es> <87incc5vvi.fsf@nicolasgoaziou.fr> <877essxx8y.fsf@mat.ucm.es> <87bmi45sm6.fsf@nicolasgoaziou.fr> <87373gxupd.fsf@mat.ucm.es> <87zi5o4cjk.fsf@nicolasgoaziou.fr> <87y3l8wfdt.fsf@mat.ucm.es> <87vagc4ayo.fsf@nicolasgoaziou.fr> <87shbg1fhl.fsf@mat.ucm.es> <87fu7g3z95.fsf@nicolasgoaziou.fr> <87fu7ghug4.fsf@mat.ucm.es> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYgxl-00049E-QD for emacs-orgmode@gnu.org; Mon, 08 Jan 2018 18:36:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYgxh-00065d-OE for emacs-orgmode@gnu.org; Mon, 08 Jan 2018 18:36:17 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:47526) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eYgxh-00064D-IV for emacs-orgmode@gnu.org; Mon, 08 Jan 2018 18:36:13 -0500 Received: from saiph.selenimh (000043010000000000000469.ipv6.commingeshautdebit.fr [IPv6:2a03:a0a0:0:4301::469]) (Authenticated sender: mail@nicolasgoaziou.fr) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id E6FFA172094 for ; Tue, 9 Jan 2018 00:36:11 +0100 (CET) Received: from ngz by saiph.selenimh with local (Exim 4.89) (envelope-from ) id 1eYgxf-0001oz-73 for emacs-orgmode@gnu.org; Tue, 09 Jan 2018 00:36:11 +0100 In-Reply-To: <87fu7ghug4.fsf@mat.ucm.es> (Uwe Brauer's message of "Mon, 08 Jan 2018 23:11:39 +0100") 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: emacs-orgmode@gnu.org Uwe Brauer writes: > > Uwe Brauer writes: > > > You don't need to. These are only suggestions, the final format nee= ds > > not matching any item in this list. > > > > Not really. See `org-table-export' docstring, last paragraph. > > > > You could try (untested): > > > (defun my-format-timestamps (cell) > > (org-quote-csv-field > > (replace-regexp-in-string > > org-ts-regexp-both > > (lambda (m) > > (if (not org-display-custom-times) (substring m 1 -1) > > (let ((hours? (string-match-p "[0-9]+:[0-9]+" m))) > > (format-time-string (funcall (if hours? #'cdr #'car) > > org-time-stamp-custom-fo= rmats) > > (org-parse-time-string m))))) > > cell))) > > > Thanks very much, but the outcome of that function for the table > > | <2017-12-19 Tue> | 189.09 =E2=82=AC | > | <2017-12-21 Wed> | 27.86 =E2=82=AC | > > > < 01.01.70 >,189.09 =E2=82=AC > < 01.01.70 >,27.86 =E2=82=AC > > > For all timestamp could expanded into the same string and the < > were > left in place. Ah well, this was a basis to get you started... This one should work (defun my-format-timestamps (cell) (org-quote-csv-field (replace-regexp-in-string org-ts-regexp-both (lambda (m) (format-time-string (let ((hours? (string-match-p "[0-9]+:[0-9]+" m))) (funcall (if hours? #'cdr #'car) org-time-stamp-custom-formats)) (apply #'encod-time (save-match-data (org-parse-time-string m))))) cell)))