Trouble with parsing date and time

Hi, can someone please look at what I am doing wrong?
I am trying to use String to date&time node and can`t seem to parse this format

Here is what I wrote down:

And here is the error I keep getting

hi @Dalmatino16 ,
a possible problem I see is that hour looks separated by two spaces from yyyy

Hi, I get the same error whether I use one or two spaces between years and hours. I copy pasted column im MS Word and turned on feature to show empty places with dots. Here is how the input looks like

image

I’m pretty sure some string manipulation is needed before you can parse it into a Date&Time type. Let’s beautify the string into a nice consistent format:

  1. If the hour is a single digit, there’re 2 separating spaces, otherwise it’s only 1 → remove duplicate whitespace
  2. I guess the same is true for months, so we want to replace ". " with "."
  3. Let’s also strip leading and trailing white spaces for good measure (fixes same issue with days?)

Now the date format should conform to "d.M.yyyy H" (undefined minutes and seconds are ok)

5 Likes

A regex in the String Manipulation node should do the job

regexReplace(strip($column1$),"^.*?(\\d+).*?(\\d+).*?(\\d+).*?(\\d+).*$" , "$1.$2.$3 $4")
5 Likes

Thank you Thyme for the idea.

1 Like

And thank you Duristef - it did the trick.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.