0

I am trying to pull the current date in MMDDYY format from infopath so I can use concat with some other fields to autogenerate a request number, but I am receiving the incorrect date. If I just use the Today() function I receive 9/30/2013, the correct date, but if i use something like concat(substring(addDays(today(), 42), 6, 2), substring(addDays(today(), 42), 9, 2), substring(addDays(today(), 42), 1, 4)) in order to remove the slashes it returns 11112013. What is happening on the second request to cause this?

1 Answer 1

2

InfoPath is returning the correct result. You are adding 42 days to today's date, extract the day, month and year (4 digits) and then concatenate the day, month and year without any separators.

To see how a date is stored and represented in your system, put today() into a Calculated Value property. You will see something like 2013-09-30

If you want the year with two digits, you need substring(addDays(today(), 42), 3, 2), i.e. start with the third character and extract two digits. So the whole formula will be

concat(substring(addDays(today(), 42), 6, 2), substring(addDays(today(), 42), 9, 2), substring(addDays(today(), 42), 3, 2))
1
  • Apparently I misunderstood what the addDays function was doing in the example I was using. 4 digit year is fine, so 'concat(substring(today(), 6, 2), substring(today(), 9, 2), substring(today(), 1, 4))' worked perfectly. Thanks for your help.
    – S0L1D
    Oct 1, 2013 at 13:46

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.