# Parsing %\_file\_create\_datetime%

**URL:** https://community.mp3tag.de/t/parsing-file-create-datetime/15513
**Category:** Support
**Created:** [February 15, 2014, 11:34pm UTC](https://community.mp3tag.de/t/parsing-file-create-datetime/15513 "2014-02-15T23:34:23Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![cdewitt](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/898d66/32.png) [@cdewitt](https://community.mp3tag.de/u/cdewitt)
#### Post date: [February 15, 2014, 11:34pm UTC](https://community.mp3tag.de/t/parsing-file-create-datetime/15513/1 "2014-02-15T23:34:23Z")

</div>

Hi, I'm trying to rename podcast files with a date that will allow them to be sorted in order and be readable. I’ve been using the “Tag – Filename” converter with the following script

%\_directory% $cutLeft(%\_file\_create\_date%,4)-$num($mid(%\_file\_create\_date%,1,2),2)-$num($mid(%\_file\_create\_date%,1,2),2)

The end of last year when I find MP3TAG it worked fine because the month and date were both 2 digit numbers but now I’ve got a problem. The date string 2112014 is ambiguous. It could be Jan 21, 2014 or Nov 2, 2014 and I can’t parse it.  
Is there a way around this?

Thanks,  
cdewitt

---

<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: [February 16, 2014, 9:07am UTC](https://community.mp3tag.de/t/parsing-file-create-datetime/15513/2 "2014-02-16T09:07:07Z")

</div>

> [@cdewitt](#):
>
> Hi, I'm trying to rename podcast files ... %\_file\_create\_date%...ambiguous...  
> Is there a way around this?
> 
> Thanks,  
> cdewitt

If you have real Podcasts then usually the have a filled field RELAESETIME which has a fixed format.  
Coming back to you original problem:  
You would have to use common sense: as it is rather unlikely that you have podcasts for November already in January it must be the January.  
So from now until September, it is always the digit before 2014 that describes the month.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [February 16, 2014, 9:18am UTC](https://community.mp3tag.de/t/parsing-file-create-datetime/15513/3 "2014-02-16T09:18:40Z")

</div>

> [@cdewitt](#):
>
> Hi, I'm trying to rename podcast files with a date that will allow them to be sorted in order and be readable. I’ve been using the “Tag – Filename” converter with the following script  
> %\_directory% $cutLeft(%\_file\_create\_date%,4)-$num($mid(%\_file\_create\_date%,1,2),2)-$num($mid(%\_file\_create\_date%,1,2),2)  
> The end of last year when I find MP3TAG it worked fine because the month and date were both 2 digit numbers but now I’ve got a problem. The date string 2112014 is ambiguous. It could be Jan 21, 2014 or Nov 2, 2014 and I can’t parse it.Is there a way around this? Thanks,cdewitt

The Mp3tag system variable **%\_file\_create\_date%** delivers a date format, which is preset by the system region/date/time settings.  
You did not say, what your system date format setting look like, so I will demonstrate a few examples.

First to say ... regarding some system date format settings your format string is bad ...

**$cutLeft(%\_file\_create\_date%,4)'-'$num($mid(%\_file\_create\_date%,1,2),2)'-'$num($mid(%\_file\_create\_date%,1,2),2)**

This is my recommendation ...  
... set system date format to world wide standard format "YYYY-MM-DD" (ISO 8601)  
(in Germany "JJJJ-MM-TT") ...

**e. g. %\_file\_create\_date% ==\> "2014-02-17" $replace(%\_file\_create\_date%,'-',) ==\> "20140217"**

Set system date format to "DD.MM.YYYY"  
(in Germany "TT.MM.JJJJ") ...

**e. g. %\_file\_create\_date% ==\> "17.02.2014" Your format string is bad ... ==\> "2.2014-17-17" $right(%\_file\_create\_date%,4)$mid(%\_file\_create\_date%,4,2)$left(%\_file\_create\_date%,2) ==\> "20140217" $right(%\_file\_create\_date%,4)'-'$mid(%\_file\_create\_date%,4,2)'-'$left(%\_file\_create\_date%,2) ==\> "2014-02-17"**

Set system date format to "D.M.YYYY"  
(in Germany "T.M.JJJJ") ...

**e. g. %\_file\_create\_date% ==\> "17.2.2014" Your format string is bad ... ==\> ".2014-17-17" $regexp($regexp(%\_file\_create\_date%,'(\d{1,2})\.(\d{1,2})\.(\d{4})','0000$3-00$2-00$1'),'0\*(\d{4})-0\*(\d{2})-0\*(\d{2})','$1-$2-$3')** 

... or ...

 $regexp($regexp(%\_file\_create\_date%,'(\d+)\.(\d+)\.(\d+)','0000$3-00$2-00$1'),'0\*(\d\d\d\d)-0\*(\d\d)-0\*(\d\d)','$1-$2-$3') 

... or ...

 $regexp($regexp(%\_file\_create\_date%,'(\d+)\.(\d+)\.(\d+)','0000$3-00$2-00$1'),'0\*(\d{4})-0\*(\d{2})-0\*(\d{2})','$1-$2-$3') ==\> "2014-02-17"

DD.20140216.1118.CET, DD.20160410.0827.CEST

---

<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: [March 12, 2024, 6:50am UTC](https://community.mp3tag.de/t/parsing-file-create-datetime/15513/4 "2024-03-12T06:50:45Z")

</div>

A post was split to a new topic: [Remove "- from date](https://community.mp3tag.de/t/remove-from-date/64043)

---

<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: [March 13, 2024, 1:09pm UTC](https://community.mp3tag.de/t/parsing-file-create-datetime/15513/5 "2024-03-13T13:09:36Z")

</div>


