Re: ascii-timestamps like 31.12.2021 to iso(org) format <2020-12-31> and back

2022-01-04 Thread Max Nikulin

On 31/12/2021 20:21, Uwe Brauer wrote:


Does anybody know about a function that would convert between
date format  like 31.12.2021 to  <2020-12-31> and back?


Uwe, I suggest you to create a feature request at 
https://debbugs.gnu.org for emacs to add a function similar to strptime 
that can parse date-time string accordingly to given format, see
info "(libc) Low-Level Time String Parsing" 
https://www.gnu.org/software/libc/manual/html_node/Low_002dLevel-Time-String-Parsing.html


Actually, I suppose, you need a function that parses date accordingly to 
current locale. It can be added to the feature request as well (and Eli 
will say that since Emacs is a multilingual editor, there is no well 
defined "current locale").





Re: ascii-timestamps like 31.12.2021 to iso(org) format <2020-12-31> and back

2021-12-31 Thread Eric S Fraga
On Friday, 31 Dec 2021 at 17:05, Uwe Brauer wrote:
> Thanks the \{4\} surprise me. I tried
>
> (query-replace-regexp "\\(\\<[0-9]*\\)\\([\\.]\\)\\([0-9]*\\>\\)" "\\3\\2\\1")

Not sure what this is trying to do.  If it's going from <2021-12-31> to 
31.12.2021, you shouldn't escape the < or >, you are not matching the -, and 
there are only 2 number matches.  Maybe you want

<\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\)>
to
\\3.\\2.\\1

?

-- 
: Eric S Fraga, with org release_9.5.2-289-gce75d2 in Emacs 29.0.50
: Latest paper written in org: https://arxiv.org/abs/2106.05096



Re: ascii-timestamps like 31.12.2021 to iso(org) format <2020-12-31> and back

2021-12-31 Thread Uwe Brauer
>>> "ESF" == Eric S Fraga  writes:

> On Friday, 31 Dec 2021 at 14:21, Uwe Brauer wrote:
>> ⚠️ Caution: External sender
>> 
>> 
>> Hi
>> 
>> Does anybody know about a function that would convert between
>> date format  like 31.12.2021 to  <2020-12-31> and back?

> This is Emacs, of course, so you could use query-replace-regexp (M-%)
> with, for instance

> \([0-9][0-9]\)\.\([0-9][0-9]\)\.\([0-9]\{4\}\)

> as the pattern to search for and

> <\3-\2-\1>

> as the replacement.  The converse is left as an exercise for the
> reader. ;-)

Thanks the \{4\} surprise me. I tried

(query-replace-regexp "\\(\\<[0-9]*\\)\\([\\.]\\)\\([0-9]*\\>\\)" "\\3\\2\\1")

And that did not work.

Uwe 


smime.p7s
Description: S/MIME cryptographic signature


Re: ascii-timestamps like 31.12.2021 to iso(org) format <2020-12-31> and back

2021-12-31 Thread Eric S Fraga
On Friday, 31 Dec 2021 at 14:21, Uwe Brauer wrote:
> ⚠️ Caution: External sender
>
>
> Hi
>
> Does anybody know about a function that would convert between
> date format  like 31.12.2021 to  <2020-12-31> and back?

This is Emacs, of course, so you could use query-replace-regexp (M-%)
with, for instance

\([0-9][0-9]\)\.\([0-9][0-9]\)\.\([0-9]\{4\}\)

as the pattern to search for and

<\3-\2-\1>

as the replacement.  The converse is left as an exercise for the
reader. ;-)

-- 
: Eric S Fraga, with org release_9.5.2-289-gce75d2 in Emacs 29.0.50
: Latest paper written in org: https://arxiv.org/abs/2106.05096



ascii-timestamps like 31.12.2021 to iso(org) format <2020-12-31> and back

2021-12-31 Thread Uwe Brauer


Hi

Does anybody know about a function that would convert between 
date format  like 31.12.2021 to  <2020-12-31> and back?

Thanks

Uwe Brauer