Problem with String to DateTime Node

Hello all,

I have some problem when try to phase millisecond with String to Date Time Node.
The node cannot phase my string “2021040211045139” with format like “yyyyMMddHHmmssSS”. It always shows error. I add to add “.” to my string and it will be “20210402110451.39”. Then the node can phrase fine with format like “yyyyMMddHHmmss.SS”. I attachment 2 images below to show the problem. Could you help me to phrase date time with original string with format “yyyyMMddHHmmssSS”. Thank you.



Hi @Maykungth ,

interesting case, I did a bit of research. This is actually a bug in Java 8, see Is java.time failing to parse fraction-of-second? - Stack Overflow. As the upcoming release of version 4.4 of KNIME will use Java 11, your format will work there. For now, I guess you need to use a workaround. You can use the String Manipulation node with the expression join(substr($column1$, 0, 14), ".", substr($column1$, 14)) (where column1 is the name of your column) to insert the period before the milliseconds. Then you can use yyyyMMddHHmmss.SS as date format.

Hope this works for you.



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