#1 2014-10-22 10:06

user108
Member
Registered: 2014-10-22
Posts: 3

Is it possible to change date format from dd.mm.yyyy to yyyy-mm-dd?

Is it possible to rename files in the following way:

BVS Bg 04.11 - Peterburg 30.10.2010  -->  BVS Bg 04.11 - Peterburg 2010-10-30
BVS Bg 04.13 - Riga 14.10.2011         -->   BVS Bg 04.13 - Riga 2011-10-14
BVS Bg 02.15 - Minsk 23.09.97           -->   BVS Bg 02.15 - Minsk 97-09-23

Last edited by user108 (2014-10-22 10:32)

Offline

#2 2014-10-22 15:28

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,367

Re: Is it possible to change date format from dd.mm.yyyy to yyyy-mm-dd?

Yes, you can do this with a RegEx rule:

Replace expression "(\d{1,2})\.(\d{1,2})\.(\d{2,4})" with "$3-$2-$1"

Offline

#3 2014-10-22 19:10

user108
Member
Registered: 2014-10-22
Posts: 3

Re: Is it possible to change date format from dd.mm.yyyy to yyyy-mm-dd?

Thank you very much! It works.

Please help me one more time. What about the following two rules?

1)  BVS Bg 13.28 - Riga 07.92               -->   BVS Bg 13.28 - Riga 92-07
2)  BVS Bg 13.08-13 - Moscow 05.1994  -->   BVS Bg 13.08-13 - Moscow 1994.05

--
Best regards,

Denis

Last edited by user108 (2014-10-23 21:01)

Offline

#4 2014-10-24 07:00

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Is it possible to change date format from dd.mm.yyyy to yyyy-mm-dd?

user108 wrote:

1)  BVS Bg 13.28 - Riga 07.92               -->   BVS Bg 13.28 - Riga 92-07
2)  BVS Bg 13.08-13 - Moscow 05.1994  -->   BVS Bg 13.08-13 - Moscow 1994.05


You can find out that yourself, see

\. ==> means: match a literal dot

\d{2,4} ==> means: match two till four digits

(...) ==> the parentheses means: capture what is matched, for reuse with $1 sign ($1,$2,... counts () from the left)



In your case, you have to add a trailing "$" sign, to match the digits only at the end of your string (name)

See http://www.den4b.com/wiki/ReNamer:Regular_Expressions  for more.

- - -


RegEx rule:
(http://www.den4b.com/wiki/ReNamer:Rules:RegEx)

Expression: (\d{1,2})\.(\d{2,4})$
Replace:     $2-$1


 


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#5 2014-10-24 21:49

user108
Member
Registered: 2014-10-22
Posts: 3

Re: Is it possible to change date format from dd.mm.yyyy to yyyy-mm-dd?

Thank you, Stefan!

--
Best regards,

Denis

Offline

#6 2016-02-08 18:40

NWH6
Member
Registered: 2016-02-08
Posts: 1

Re: Is it possible to change date format from dd.mm.yyyy to yyyy-mm-dd?

den4b wrote:

Yes, you can do this with a RegEx rule:

Replace expression "(\d{1,2})\.(\d{1,2})\.(\d{2,4})" with "$3-$2-$1"

Some files sent to me contain 2 dates in the filename. They were formatted in dd-mm-yyyy-dd-mm-yyyy, I wanted them as yyyymmdd-yyyymmdd!

Found this and it's great. And the one entry does both dates - I'm still not sure how it works but it does.

Thank you for a great product.


“You will do foolish things, but do them with enthusiasm.” - Colette

Offline

#7 2016-02-09 02:05

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,367

Re: Is it possible to change date format from dd.mm.yyyy to yyyy-mm-dd?

You should check out the new Reformat Date rule, which is available in the latest development version.

Offline

Board footer

Powered by FluxBB