In this InfoPath SharePoint tutorial, I am going to explain how to format date in InfoPath 2013 in SharePoint 2013/2016/Online. I will show how we can format date which returns from an inbuilt function like Date() or now().
Get SharePoint Online (Office 365 Enterprise E3) Subscription for your Business NOW
Recently I got a requirement to display the current date in a single line of textbox based on some rules. For this requirement, you can use the InfoPath inbuilt function known as today() or now(). But here we will see how we can format the date from the default format yyyy-mm-dd to mm-dd-yyyy.
By default if you will try to populate current date by using Date() function in InfoPath 2013, it will appear in yyyy-mm-dd like below:
But you can do some string manipulation if you want to have in a different format like mm-dd-yyyy or dd-mm-yyyy.
Below is an example:
concat(substring(today(), 6, 2), “/”, substring(today(), 9, 2), “/”, substring(today(), 1, 4))
concat(substring(now(), 6, 2), “/”, substring(now(), 9, 2), “/”, substring(now(), 1, 4))
Now after this string manipulation the date will appear like below:
You may like following InfoPath SharePoint tutorial below:
- How to publish an infopath form to an email in SharePoint 2013?
- How to publish InfoPath forms as a content type in SharePoint 2013?
- Deploy Administration approved InfoPath forms in SharePoint 2013
- Publish InfoPath Form to SharePoint Online Office 365 Step by Step Tutorial
- SharePoint 2013 Calculate business day from InfoPath date picker or Get Day from a selected date in Date picker in InfoPath 2013
- Make attachment field mandatory in InfoPath Designer 2013 in SharePoint Online list
- InfoPath 2013 show hide section using Rules in SharePoint online
- InfoPath 2013 multiple attachments
Hope this will be helpful to format a date in InfoPath 2013/2016/Online.