Execution of the Create Date&Time node at the full minute leads to the loss of the seconds specification

Hi everybody,

I have a problem with converting a Date&Time value to a string and back to a Date&Time value.

In the appendix you will find a highly simplified workflow that illustrates my process. It is already executed and reproduces the problem.

With Create Date&Time Range I generate a single date point at the time of execution to use it as a timestamp.

For use in the workflow, I convert it into a flow variable, i.e. a string, and later convert it back into a Date&Time value using String to Date&Time. The latter takes the format yyyy-MM-dd'T'HH:mm:ss.

The problem I observe is the following error message:
ERROR String to Date&Time 2:145 Execute failed: Failed to parse date in row 'values: Text '2019-03-13T10:27' could not be parsed at index 16

If the Create Date&Time node is executed exactly at 10:27:00, the generated value does not get seconds (2019-03-13T10:27). When converting into a flow variable, the seconds are not added either. Thus the specified date format in the String to Date&Time cannot hit and the node terminates.

Is there a way to work around this problem?

Thank you very much for your help. :slight_smile:

timestamp_without_seconds.knwf (16.8 KB)

Hi there!

Sure there is a way around. You need to put :ss inside square brackets [ ].
This will indicate that :ss is optional part :wink:

Br,
Ivan

1 Like

Jeez, you’d think I’d never worked with date formats before. :man_facepalming: Thanks a lot, Ivan!

1 Like

You are welcome.
Create Date&Time Range node can also create milliseconds if you need. This gives you a bit smaller possibility you will only have hours and minutes :smiley:
Br,
Ivan

2 Likes

Even better! Thanks again. :blush: At the moment I do not see the wood for the trees. :sweat_smile:

2 Likes