0

I am trying to have the Calculated Date field be the first of the month, the month before Start Date. This works when the Calculated Date month is double digit but breaks on single digit months. Any suggestions on how I can fix this?

concat(substring(StartDate[ID = Availability], 1, 4), "-", string(number(substring(StartDate[ID = Availability], 6, 2)) - 1), "-01T00:00:00")

Example Dates

EDIT: Corrected Screenshot

1 Answer 1

1

I was able to resolve the issue by modifying my code to:

concat(substring(StartDate[ID = Availability], 1, 4), "-", (concat(substring("00", 1, 2 - string-length(substring(StartDate[ID = Availability], 6, 2) - 1)), (substring(StartDate[ID = Availability], 6, 2)) - 1)), "-01T00:00:00")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.