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

**URL:** https://community.mp3tag.de/t/converting-date-format-in-date-to-yyyy-mm-dd-in-export/67201
**Category:** Support
**Created:** [January 19, 2025, 2:25am UTC](https://community.mp3tag.de/t/converting-date-format-in-date-to-yyyy-mm-dd-in-export/67201 "2025-01-19T02:25:02Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![tor11](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/ebca7d/32.png) [@tor11](https://community.mp3tag.de/u/tor11)
#### Post date: [January 19, 2025, 2:25am UTC](https://community.mp3tag.de/t/converting-date-format-in-date-to-yyyy-mm-dd-in-export/67201/1 "2025-01-19T02:25:02Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)
#### Post date: [January 19, 2025, 8:16am UTC](https://community.mp3tag.de/t/converting-date-format-in-date-to-yyyy-mm-dd-in-export/67201/2 "2025-01-19T08:16:08Z")

</div>

> [@tor11](#):
>
> %\_date% generates this format: 19. 1. 2025

Here %\_date% creates this format `19.01.2025` .

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [January 19, 2025, 9:31am UTC](https://community.mp3tag.de/t/converting-date-format-in-date-to-yyyy-mm-dd-in-export/67201/3 "2025-01-19T09:31:35Z")

</div>

> [@tor11](#):
>
> %\_date% generates this format: 19. 1. 2025

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

 ![image](https://community.mp3tag.de/uploads/default/original/3X/9/6/965c627652a9bf96a44629f09e95362734d21f8d.png)

---

<div class="post-metadata">

### Author: ![tor11](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/ebca7d/32.png) [@tor11](https://community.mp3tag.de/u/tor11)
#### Post date: [January 19, 2025, 4:48pm UTC](https://community.mp3tag.de/t/converting-date-format-in-date-to-yyyy-mm-dd-in-export/67201/4 "2025-01-19T16:48:06Z")

</div>

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

 ![2025-01-19_173759](https://community.mp3tag.de/uploads/default/original/3X/5/0/50ea9eb875b609203e869d3e29e0f23bff4c99ba.png)  
Thanks!

---

<div class="post-metadata">

### Author: ![Crissov](https://community.mp3tag.de/user_avatar/community.mp3tag.de/crissov/32/6619_2.png) [@Crissov](https://community.mp3tag.de/u/Crissov)
#### Post date: [January 20, 2025, 7:02am UTC](https://community.mp3tag.de/t/converting-date-format-in-date-to-yyyy-mm-dd-in-export/67201/5 "2025-01-20T07:02:33Z")

</div>

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)`

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 20, 2025, 7:16am UTC](https://community.mp3tag.de/t/converting-date-format-in-date-to-yyyy-mm-dd-in-export/67201/6 "2025-01-20T07:16:23Z")

</div>

> [@tor11](#):
>
> %\_date% generates this format: 19. 1. 2025

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)`

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 19, 2025, 7:17am UTC](https://community.mp3tag.de/t/converting-date-format-in-date-to-yyyy-mm-dd-in-export/67201/7 "2025-02-19T07:17:10Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
