emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] org table with datestamp convert to csv and then xlsx or ods: pr


From: Nicolas Goaziou
Subject: Re: [O] org table with datestamp convert to csv and then xlsx or ods: problem
Date: Tue, 09 Jan 2018 00:36:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Uwe Brauer <address@hidden> writes:

>     > Uwe Brauer <address@hidden> writes:
>
>     > You don't need to. These are only suggestions, the final format needs
>     > 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-formats)
>     >                                   (org-parse-time-string m)))))
>     >         cell)))
>
>
> Thanks very much, but the outcome of that function for the table
>
>   | <2017-12-19 Tue> | 189.09 € |
>   | <2017-12-21 Wed> | 27.86  € |
>
>
> < 01.01.70 >,189.09 €
> < 01.01.70 >,27.86  €
>
>
> 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)))



reply via email to

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