1

I have a 2010 InfoPath form with 2 controls. I have a dropdown control called Colors with values Red, Yellow and Green. Lastly I have TextBox control called TaskComplete below:

enter image description here

I then created an Action for my Colors control. The condition is if Colors = Red then set the value in TaskComplete to Today’s date below:

enter image description here

However, when I set the colors to Red, it returns the date as yyyy-mm-dd shown below:

enter image description here

How can I have Today’s date return in mm-dd-yyyy format?

2
  • Thank you. saved me time this morning looking for this very answer on how to format a date field that has a formula using now() instead of today(). YAY
    – Joan
    Jul 6, 2017 at 11:39
  • As Aspire27 said, use now(). That's pretty idiotic, Microsoft. I had tried having my Date field look at the other pull-down field for when it changed. That didn't work. I had told the date field to format as YYYY-MM-DD (which is how it appeared in the date text box and was acceptable when hand-typed). No go.
    – Randall
    Aug 8, 2017 at 10:57

3 Answers 3

3

When you set the field type, did you format that date block as the appropriate setting?

enter image description here

7
  • You're wanting me to change my 'Data type' in Properties of my TextBox to Date? Reason I ask because, as is, the Format button is grayed out. However, if I change it to Date I can change the Format.
    – Nina G
    Oct 20, 2016 at 15:25
  • 1
    The easiest way is to change the field from text to date and then add whatever function you need. Oct 20, 2016 at 15:31
  • I opened the properties of my TextBox and set the Data type to 'Date'. I then click on Format and choose the format as mm/dd/yyyy. I then test and when I change the Colors to Red, the TextBox border goes red dashes and the error states 'Only date or date time allowed'.
    – Nina G
    Oct 20, 2016 at 15:31
  • You may have to go back and review the rule that you placed and or update the rule to show the new "date field". Oct 20, 2016 at 15:33
  • The rule is pretty simple. If Color = Red set TaskComplete to Today(). No error in that rule. It has to be done another way maybe in Properties but no clue as to how else I can format.
    – Nina G
    Oct 20, 2016 at 15:35
1

I changed the Data type to Date and reformatted the rule to use now() instead of Today(). That returned the date as mm-dd-yyyy format.

0

As said...use now() function.

Infopath suggest you use it for SharePoint list columns when today() is selected.

enter image description here

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.