Solved

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

  • 1 October 2021
  • 2 replies
  • 35 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?

icon

Best answer by leighburke 4 October 2021, 02:35

View original

2 replies

Userlevel 5
Badge +13

@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🇲🇲SS format option, use modify string action to remove the -,:,SS to get the format you need.

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).

Reply