Skip to main content
Nintex Community Menu Bar
Solved

Efficient way to achieve a custom format date in a component workflow

  • October 1, 2021
  • 2 replies
  • 104 views

I'd like to create a string from the current date context variable in the following format: YYYYMMDDHHmm

On a form you can create a variable and use the formatDate function to specify a custom date format.
Is there any way to do the same with a component workflow?

If not, is there a cleaner way to do it than:
1. format date to string
2. apply a regular expression
3. loop through each character in the result collection and create a string concatenating each character?

Best answer by leighburke

@AdrianM Is the issue that the format date to string doesn't allow the format you are looking for? If so I would suggest raising or voting on the uservoice for more date formatting options(https://nintex.uservoice.com/forums/430063-5-nintex-workflow-cloud/suggestions/38435017-more-date-formats). The other option is using the YYYY-MM-DD HH:mm:SS format option, use modify string action to remove the -,:,SS to get the format you need.

2 replies

Forum|alt.badge.img+14
  • Nintex Employee
  • Answer
  • October 4, 2021

@AdrianM Is the issue that the format date to string doesn't allow the format you are looking for? If so I would suggest raising or voting on the uservoice for more date formatting options(https://nintex.uservoice.com/forums/430063-5-nintex-workflow-cloud/suggestions/38435017-more-date-formats). The other option is using the YYYY-MM-DD HH:mm:SS format option, use modify string action to remove the -,:,SS to get the format you need.


  • Author
  • October 5, 2021

Thanks @leighburke. Yes, that's right. It's a format that is not in the list. Modify string looks like a cleaner option. I just have to do that three times (one for '-' one for ':' and one with a single space string stored in a variable).