I need to format a date using a workflow from datetime to just the date in the this format: YYYYMMDD
Example:
Before: 8/7/2023 12:00:00 AM
After: 20230807
I only need the formatted date for a specific SharePoint 2016 list, thus why I need the workflow to format it. It is a site workflow that is scheduled to run.
I’ve seen some guides on formatting the date but none have worked when I try to do the specific format I need.
Best answer by bamaeric
You can use the Set Variable action to format the date and store it in a workflow variable. Here are the steps to accomplish this:
Get the value of the date from the item and store it in a variable of type “Date and Time”.
Add a Set Variable action to the workflow and configure it with these settings: - Set = txtStartDateFormatted (this is a text workflow variable). - Equals Value and then click on the Insert Reference button on the right. - Go to the Inline Functions tab and add the fn-FormatDate function. - Configure this as fn-FormatDate(dtStartDate,"yyyyMMdd")
You can then use that variable anywhere else in the workflow.
You can use the Set Variable action to format the date and store it in a workflow variable. Here are the steps to accomplish this:
Get the value of the date from the item and store it in a variable of type “Date and Time”.
Add a Set Variable action to the workflow and configure it with these settings: - Set = txtStartDateFormatted (this is a text workflow variable). - Equals Value and then click on the Insert Reference button on the right. - Go to the Inline Functions tab and add the fn-FormatDate function. - Configure this as fn-FormatDate(dtStartDate,"yyyyMMdd")
You can then use that variable anywhere else in the workflow.
You can use the Set Variable action to format the date and store it in a workflow variable. Here are the steps to accomplish this:
Get the value of the date from the item and store it in a variable of type “Date and Time”.
Add a Set Variable action to the workflow and configure it with these settings: - Set = txtStartDateFormatted (this is a text workflow variable). - Equals Value and then click on the Insert Reference button on the right. - Go to the Inline Functions tab and add the fn-FormatDate function. - Configure this as fn-FormatDate(dtStartDate,"yyyyMMdd")
You can then use that variable anywhere else in the workflow.