# Convert the iTunes date format in the "year" tag of the files!

**URL:** <https://community.mp3tag.de/t/convert-the-itunes-date-format-in-the-year-tag-of-the-files/63129>\
**Category:** Support\
**Created:** [December 18, 2023, 2:19pm UTC](https://community.mp3tag.de/t/convert-the-itunes-date-format-in-the-year-tag-of-the-files/63129 "2023-12-18T14:19:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Palladio](https://community.mp3tag.de/user_avatar/community.mp3tag.de/palladio/32/10154_2.png) [@Palladio](https://community.mp3tag.de/u/Palladio)\
**Post date:** [December 18, 2023, 2:19pm UTC](https://community.mp3tag.de/t/convert-the-itunes-date-format-in-the-year-tag-of-the-files/63129/1 "2023-12-18T14:19:16Z")

</div>

The date format in the "year" field in files downloaded from **iTunes** or albums with iTunes format is "2019-10-04T12:00:00Z".  
This format is problematic for archives and folders of albums.

Is there a way to keep the " **first four characters**" and **remove** the rest of the characters so that **only the release year** of the album is stored in the files "year" field?

2019-10-04T12:00:00Z == change to ==\> 2019

If the **number of characters** is more than **four** , the f **irst four characters** are **kept** and the **rest of the characters** are **removed** as many as they are, so that it is only stored in the album release **year date field**. Remove more characters

---

<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:** [December 18, 2023, 2:40pm UTC](https://community.mp3tag.de/t/convert-the-itunes-date-format-in-the-year-tag-of-the-files/63129/2 "2023-12-18T14:40:55Z")

</div>

If you are sure that the first 4 characters in YEAR always contains the year number with 4 digits, then you could use  
Convert Tag - Tag  
Field: YEAR  
Format string:  
`$left(%YEAR%,4)`

This would not work for a YEAR looking like this:  
10-04-2019T12:00:00Z

---

<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:** [December 18, 2023, 3:06pm UTC](https://community.mp3tag.de/t/convert-the-itunes-date-format-in-the-year-tag-of-the-files/63129/3 "2023-12-18T15:06:36Z")

</div>

I would save this long date into RELEASETIME before I would delete anything.

Alternative to

> [@LyricsLover](#):
>
> $left(%YEAR%,4)

you could also use  
`$num(%year%,1)`

---

<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:** [December 18, 2023, 3:27pm UTC](https://community.mp3tag.de/t/convert-the-itunes-date-format-in-the-year-tag-of-the-files/63129/4 "2023-12-18T15:27:34Z")

</div>

> [@ohrenkino](#):
>
> you could also use  
> `$num(%year%,1)`

For those interested why this works too (from the [documentation](https://docs.mp3tag.de/scripting/#string-functions)):

 ![image](https://community.mp3tag.de/uploads/default/original/2X/3/3b6fa5f36ea598276476f4b999a47d005593a390.png)

`$num(x,y)` takes the digits from the left until the first non-numeric character.  
In the example string  
2019-10-04T12:00:00Z  
the first non-numeric character from the left is the - between 2019 and 10.  
So 2019 will be returned and padded with 1 digit.  
Since 2019 is already 4 digits long, there is no visible padding.  
If you would use  
`$num(%year%,6)`  
you would get  
002019

---

<div class="post-metadata">

**Author:** ![Palladio](https://community.mp3tag.de/user_avatar/community.mp3tag.de/palladio/32/10154_2.png) [@Palladio](https://community.mp3tag.de/u/Palladio)\
**Post date:** [December 18, 2023, 3:33pm UTC](https://community.mp3tag.de/t/convert-the-itunes-date-format-in-the-year-tag-of-the-files/63129/5 "2023-12-18T15:33:52Z")

</div>

Thanks, I understood how it works by reading your explanation

---

<div class="post-metadata">

**Author:** ![Palladio](https://community.mp3tag.de/user_avatar/community.mp3tag.de/palladio/32/10154_2.png) [@Palladio](https://community.mp3tag.de/u/Palladio)\
**Post date:** [December 18, 2023, 3:35pm UTC](https://community.mp3tag.de/t/convert-the-itunes-date-format-in-the-year-tag-of-the-files/63129/6 "2023-12-18T15:35:21Z")

</div>

Fortunately, both solutions work for this scenario  
Thanks to both of you:  
@ohrenkino @LyricsLover

---

<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:** [January 17, 2024, 3:35pm UTC](https://community.mp3tag.de/t/convert-the-itunes-date-format-in-the-year-tag-of-the-files/63129/7 "2024-01-17T15:35:35Z")

</div>

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