Parsing %_file_create_datetime%

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?


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.

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 ...


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 ...


... 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