How do I...?

How to Return a 2-Digit Value for Date Formula "Month(date)" and "Day(date)"

Using the month() and day() formula result in a single digit number returning. eg: January = 1.

Is there a way to have a 2 digit value return for all?
eg: January=01

I'm trying to get a result of: 2014-01-15

concatenate(year({Month Ending}),"-",month({Month Ending}),"-",day({Month Ending}))

0 votes
Vote
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
John McGarvey shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

2 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...
  • Jake Marwil commented  ·   ·  Flag as inappropriate

    Hi John,

    To obtain a result like "2014-01-15", you will need to add some conditionals into your calculation. You could use:

    year({Month Ending}) & "-" & if(month({Month Ending})<10,"0" & month({Month Ending}),month({Month Ending})) & "-" & if(day({Month Ending})<10, "0" & day({Month Ending}), day({Month Ending}))

    This will output the way you are looking for in a calculated text field and will also return a valid date if you are using a calculated date field. Please let us know if you have any further questions.

    Regards,

    Jake

Feedback and Knowledge Base