AdrianM
Rookie

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

Jump to solution

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?

Labels: (1)
0 Kudos
Reply
2 Replies
leighburke
Nintex Employee
Nintex Employee

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

Jump to solution

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

View solution in original post

0 Kudos
Reply
AdrianM
Rookie

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

Jump to solution

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

0 Kudos
Reply