I'm struggling to convert USA dates like these:
9/26/20
10/9/21
12/21/22
to these UK equivalents:
26/9/20
9/10/21
21/12/22
Even better would be padded results like this:
26/09/20
09/10/21
21/12/22
Is it possible in a single run please?
USA dates to UK?
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Re: USA dates to UK?
You could have searched the forums and would have found Formatting the system date in a macro: and replace it in a just different order: Successfully tested with 8.4.2.
That's halfway what you want: a date in the US format and adding leading zeroes (minus the century in the year).
While the output is not what you want, over all the years you surely learnt at least basics of regex. So you just have to adapt to it and want to actually search for a 2 digit year only:ben_josephs wrote: ↑Sun Dec 04, 2022 11:07 pm Search | Replace... (<F8>):Find what: \b(\d)?(\d)/(\d)?(\d)/(\d{4})\b
Replace with: $5-(?1$1:0)$2-(?3$3:0)$4
[X] Regular expression
Code: Select all
\b(\d)?(\d)/(\d)?(\d)/(\d{2})\b
Code: Select all
(?3$3:0)$4/(?1$1:0)$2/$5
Re: USA dates to UK?
Forgive me for this late reply. I appreciate your efforts and much thanks.
TextPad 8.16.0 64bit in English and TextPad 9.1.0 64bit in French, on two separate Windows installations