String to Date&Time

Hello,

I need to use a string to date&time node, but I am getting the following error.

Execute failed: Failed to parse the date in row 'Row0: Text ‘2020-02-05 11:24:31’ could not be parsed at index 4

Below is a screenshot of the data. I need to break out the offense start time by year, month, time. I have tried out multiple formats but I cannot get any to work.

yyyy-MM-dd’T’hh:mm:ss a
yyyy/MM/dd’T’hh:mm:ss a

Any suggestions on the best format for this variable?

Hi @ssen,
your date delimiter is ‘-’ therfoere the data format is yyyy-MM-dd hh:mm:ss. You can enter this format if it is not in the list.

BR

1 Like

Hi @ssen
You could also use the “Guess date type and format” button which will use the contents of the first cell to make a guess. Often this is exactly what you want.

Thanks I tried that but got a new error.

ERROR String to Date&Time 0:38 Execute failed: Failed to parse date in row 'Row0: Text ‘2020-02-05 10:10:00’ could not be parsed: Unable to obtain LocalDateTime from TemporalAccessor: {SecondOfMinute=0, MicroOfSecond=0, NanoOfSecond=0, MinuteOfHour=10, MilliOfSecond=0, HourOfAmPm=10},ISO resolved to 2020-02-05 of type java.time.format.Parsed

I tried that however it cant guess the format

Hi @ssen,
please could you provide your data (only datetime columns) to have a look on it?
You could also check the string length off your datetime cells. Maybe there are existing further blanks or unvisible signs.

BR

1 Like

Hello @ssen,

in case you haven’t figured it out pattern to use is yyyy-MM-dd HH:mm:ss. You need capital H for hour as it’s values are between 0-23. Non capital h is used when you have am/pm hour values. See String to Date&Time node description for list of placeholders.

Br,
Ivan

1 Like