Infopath Extract Day, Month, or Year in InfoPath from a Date Picker field or Today

In InfoPath, under FieldsRight Click on the single line of text field and choose Field Properties.

Under the Default Value section click the “fx” button beside the blank field.

To extract the day number of a date, use
number(substring(field1, 9, 2))

To extract the month number of a date, use
number(substring(field1, 6, 2))

To extract the year number of a date, use
number(substring(field1, 1, 4))

where field1 represents a date picker control or the function of today() to pull any of those from today’s date.

This entry was posted in InfoPath, SharePoint and tagged , , . Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Your email address will not be published. Required fields are marked *