Page 1 of 1

Formatting the system date in a macro

Posted: Sat Dec 03, 2022 8:05 am
by ineuw
I use a date, time and filename macro which generates the following: 12/3/2022 - 2:57 AM - P:\doc2.txt

Is it possible to convert the date display to 2022-12-03 format?

Posted: Sun Dec 04, 2022 11:07 pm
by ben_josephs
It looks like your dates are in crazy US format. Try:

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
You can put this in a macro:
Replace = "\\b(\\d)?(\\d)/(\\d)?(\\d)/(\\d{4})\\b", "$5-(?1$1:0)$2-(?3$3:0)$4", RegExp
DoReplaceAll
Do you not want the time put into 24-hour format?

Posted: Mon Dec 05, 2022 5:56 am
by ineuw
ben_josephs wrote:It looks like your dates are in crazy US format. Try:

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
You can put this in a macro:
Replace = "\\b(\\d)?(\\d)/(\\d)?(\\d)/(\\d{4})\\b", "$5-(?1$1:0)$2-(?3$3:0)$4", RegExp
DoReplaceAll
Do you not want the time put into 24-hour format?
Much thanks for taking the time to help. It's in a new Windows 10 22H2 install whichstill needs a lot of configuration adjustments. The time format is OK.