I needed it, others needed it and it isn't in the NWC Toolkit yet. So, we'll have to do it ourselves for now: Convert a date in text format into a date variable.
Here is how it goes:
- For this example we assume the text date is in the ddmmyyyy format. In the code below you'll see how to change it for other formats.
- It's sad that we have to (ab)use a component workflow for this but until there is a decent action that does it we'll have to do it this way I guess.
- Input for the component workflow : a text variable with a date in ddmmyyyy format
- Output: a date type variable (ignore the time part as we all live in different time zones)
Here is the sequence of actions:
The trick is that we use 1-1-2020 as a reference date to add the difference in days and months from the input. The actions with the green numbers are explained in detail below.
First create a new component workflow and define your variables:
Workflow variables:
The numbered actions in detail:
0 is the position where the day starts.
2 is the number of characters for the day.
Month will 2 and 2 and year will be 4 and 4.
For other formats just change the positions.
Make sure to test it before use. No warranty. But it works for me.