Convert System Date to mmddyyyy format

Avatar

Avatar
Give Back
Level 2
alik98709228
Level 2

Likes

3 likes

Total Posts

28 posts

Correct reply

0 solutions
Top badges earned
Give Back
Ignite 1
Validate 1
Boost 3
Boost 1
View profile

Avatar
Give Back
Level 2
alik98709228
Level 2

Likes

3 likes

Total Posts

28 posts

Correct reply

0 solutions
Top badges earned
Give Back
Ignite 1
Validate 1
Boost 3
Boost 1
View profile
alik98709228
Level 2

25-03-2021

Hello,

 

I am trying to convert system date to in this format: mmddyyyy

So for today which is March 25th, 2021, it should show as 03252021

 

I am using the following formula:

 
Month(GetDate())+'/'+Day(GetDate())+'/'+Year(GetDate())
 
It worked but the results are coming up in format "3/245/2021". Is there a way, I can get the 2 digits for the month without having the "/". For instance. for today, the output should be: 0325202
 
Any ideas?
 
Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 250
MVP
DavidKangni
MVP

Likes

258 likes

Total Posts

372 posts

Correct reply

152 solutions
Top badges earned
Boost 250
Validate 1
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Boost 250
MVP
DavidKangni
MVP

Likes

258 likes

Total Posts

372 posts

Correct reply

152 solutions
Top badges earned
Boost 250
Validate 1
Give Back 5
Give Back 3
Give Back 25
View profile
DavidKangni
MVP

26-03-2021

Hi @alik98709228 

 

Please use this 

Iif(Month(GetDate())>9, ToString(Month(GetDate())), '0'+ToString(Month(GetDate())))+Iif(Day(GetDate())>9, ToString(Day(GetDate())), '0'+ToString(Day(GetDate())))+ToString(Year(GetDate()))

 

Also make sure to post in ACS forum instead of ACC.

 

Thanks,

David

Answers (1)

Answers (1)

Avatar

Avatar
Affirm 25
Level 4
Deb007
Level 4

Likes

50 likes

Total Posts

86 posts

Correct reply

25 solutions
Top badges earned
Affirm 25
Boost 25
Applaud 5
Give Back 5
Validate 1
View profile

Avatar
Affirm 25
Level 4
Deb007
Level 4

Likes

50 likes

Total Posts

86 posts

Correct reply

25 solutions
Top badges earned
Affirm 25
Boost 25
Applaud 5
Give Back 5
Validate 1
View profile
Deb007
Level 4

26-03-2021

Hi @alik98709228 ,

Hope this will work.

 

var a = formatDate(new Date(), "%2M%2D%4Y");
logInfo(a);

 

You can refer to the following for more details.

https://docs.adobe.com/content/help/en/campaign-classic/technicalresources/api/f-formatDate.html?hl=...

 

Thanks,

Deb