emacs-orgmode
[Top][All Lists]
Advanced

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

custom time format extension


From: Orm Finnendahl
Subject: custom time format extension
Date: Wed, 29 Jul 2020 22:16:34 +0200

Hi,

 when exporting timestamps it always bothered me that timestamps with
start and end time on the same day got exported with a full date for
the start and end times separated by a dash.

After thinking about this for some time I implemented a method today,
which combines the advantage of being utmost flexible while
maintaining full backwards compatibility.

This is how it works: The cdr of org-time-stamp-custom-formats
normally contains a format string for formatting timestamps with
start/end time. When supplying a list of three strings instead of the
single format string to the cdr of org-time-stamp-custom-formats, the
first, second and third elements of that list are interpreted as
follows:

The first element is the full format in case start and end of the
timestamp are not on the same day. The second element of the list is
the format string for the start time of the timestamp. The third
element of the list is a format string for the end time of the
timestamp. (BTW: Supplying a list as second element of a dotted list
is equivalent to supplying a list with four strings to
org-time-stamp-custom-formats)

Below the mail is a short example for german date strings.

In case somebody is interested, I can provide the code off list. If
any of the maintainers is reading on this list and thinks it should
get revised and maybe adopted for orgmode, please let me know how to
issue pull requests for the code. I tried to be minimally invasive ;-)

--
Orm

-----------
Example:

(org-time-stamp-custom-formats '("%a %d.%m.%Y" . ("%a %d.%m.%Y %H:%M Uhr"
                                                  "%a %d.%m.%Y %H:%M"
                                                  "%H:%M Uhr")))

Formatting

<2020-11-21 Sa>  -> Sa 21.11.2020

<2020-11-21 Sa 10:00-18:00>  -> Sa 21.11.2020 10:00--18:00 Uhr


<2020-11-21 Sa 10:00>--<2020-11-22 So 18:00> -> Sa 21.11.2020 10:00 Uhr--So 
22.11.2020 18:00 Uhr



reply via email to

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