emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: emacs-orgmode@gnu.org
Subject: Re: org table with datestamp convert to csv and then xlsx or ods: problem
Date: Tue, 09 Jan 2018 00:36:11 +0100	[thread overview]
Message-ID: <87bmi353f8.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87fu7ghug4.fsf@mat.ucm.es> (Uwe Brauer's message of "Mon, 08 Jan 2018 23:11:39 +0100")

Uwe Brauer <oub@mat.ucm.es> writes:

>     > Uwe Brauer <oub@mat.ucm.es> 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	other threads:[~2018-01-08 23:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-07 16:51 org table with datestamp convert to csv and then xlsx or ods: problem Uwe Brauer
2018-01-08 13:21 ` Nicolas Goaziou
2018-01-08 14:04   ` Uwe Brauer
2018-01-08 14:32     ` Nicolas Goaziou
2018-01-08 14:59       ` Uwe Brauer
2018-01-08 15:04         ` Nicolas Goaziou
2018-01-08 15:15           ` Uwe Brauer
2018-01-08 15:38             ` Nicolas Goaziou
2018-01-08 16:29               ` Uwe Brauer
2018-01-08 19:51                 ` Nicolas Goaziou
2018-01-08 22:11                   ` Uwe Brauer
2018-01-08 22:11                   ` Uwe Brauer
2018-01-08 23:36                     ` Nicolas Goaziou [this message]
2018-01-09  8:22                       ` Uwe Brauer
2018-01-09  8:23                       ` Uwe Brauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bmi353f8.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).