Date format missing numerals

hi! im looking to format date. [[Now.addDays(28).getFullYear()]]-[[Now.addDays(28).getMonth()]]-[[Now.addDays(28).getDate()]] gives me 2018-8-8, but i want it to show as 2018-08-08 ideas?

Try this:

[[('x0' + Now.addDays(28).getMonth()).slice(-2)]]

Repeat for day

EDIT: Should be -2 not 2.

2 Likes

tried it, didn’t work. now getting 2018-8-20 (since it adds to todays date.). Considering that month shows as “8” and no “08” i take it it didnt work
[[Now.addDays(28).getFullYear()]]-[[(‘x0’ + Now.addDays(28).getMonth()).slice(2)]]-[[(‘x0’ + Now.addDays(28).getDate()).slice(2)]]

Yup my fault I had a typo. Should be -2 instead of 2.

Ahh Excellent!

Many thanks sifu!

/Z

Thanks for sharing this three years ago! Helped me big time!!