Converting date format in %_date% to YYYY-MM-DD in Export

Hi, I'm trying to work with %_date% in Export, converting it to YYYY-MM-DD

%_date% generates this format: 19. 1. 2025

Basically I could use $regexp($regexp(%_date%,(\d+)\.\s(\d+)\.\s(\d\d\d\d),$3-$2-$1),(\d\d\d\d)-(\d+)-(\d+),$1-$2-$3)
but I don't know how to add leading zeros only for a single digit month or day?

Here %_date% creates this format 19.01.2025 .

Maybe you can have a look at your Windows settings for "Date and Time".
My settings for a German Windows looks like this:

Indeed, date format on my system was different. d. M. yyyy


Thanks!

It you don’t want to (or cannot) fix leading zeros system-wide, you can always run multiple steps to fix days and months separately with regular expressions.

$regexp($regexp($regexp(%_date%, \s*(\d+)\.\s*(\d+)\.\s*(\d{4}),$3-$2-$1),(\d{4})-(\d)-(\d+),$1-0$2-$3),(\d{4})-(\d{2})-(\d),$1-$2-0$3)

Try a format string like:
$regexp(%_date%,(\d+)\.\s*(\d+)\.\s*(\d+),$3)-$num($regexp(%_date%,(\d+)\.\s*(\d+)\.\s*(\d+),$2),2)-$num($regexp(%_date%,(\d+)\.\s*(\d+)\.\s*(\d+),$1),2)