Highlighted

Date format

New Here ,
May 08, 2020

Copy link to clipboard

Copied

I am using variables to apply the date to the course, but the client would like 05/08/2020 and the different date formats I've tried in variables will not give me the 0 in front of the day, if needed.  Is this possible?

Views

344

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Date format

New Here ,
May 08, 2020

Copy link to clipboard

Copied

I am using variables to apply the date to the course, but the client would like 05/08/2020 and the different date formats I've tried in variables will not give me the 0 in front of the day, if needed.  Is this possible?

Views

345

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 08, 2020 0
Participant ,
May 14, 2020

Copy link to clipboard

Copied

Mak a new variable with a pre value:

DateFormat = DDMMYYYY

And use cpInfoCurrentDateStringDDMMYYYY

/Jacob

 

(And if the Month first)

 

DateFormat = MMDDYYYY

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2020 0
Participant ,
May 14, 2020

Copy link to clipboard

Copied

Or 

 

var d = new Date();
var s = '';
s = d.getDate()+'/'+(d.getMonth()+1)+'/'+d.getFullYear();

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2020 0
Participant ,
May 14, 2020

Copy link to clipboard

Copied

var s = '';
s = d.getDate()+'/'+(d.getMonth()+1)+'/'+d.getFullYear(); //withOUT leading zeros
var date = new Date('4-1-2015'); // M-D-YYYY
 
var d = date.getDate();
var m = date.getMonth() + 1;
var y = date.getFullYear();
var dateString = (d <= 9 ? '0' + d : d) + '-' + (m <= 9 ? '0' + m : m) + '-' + y; //WITH leading zeros

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2020 0
Adobe Community Professional ,
May 14, 2020

Copy link to clipboard

Copied

Use this instead of a single date variable

 

$$cpInfoCurrentDate$$/$$cpInfoCurrentMonth$$/$$cpInfoCurrentYear$$

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2020 0
Participant ,
May 14, 2020

Copy link to clipboard

Copied

Doh...

I misread it. Thought it was about REMOVING the zeroes 😉

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2020 0