Hi, I have 3 columns Date and time as a string value with milisecond and local timezone (T) assigned to it. I want to remove the T and milisecond and convert the string to date and time stamp. what is the best way to do it?
For eg, “2021-07-06T12:17:57.908”(String) would like to convert to “2021-07-06 12:17:57”(Datetime stamp)
I have tried using multiple string manipulation using function substr($$CURRENTCOLUMN$$,0 ,10 ) + ’ ’ + substr($$CURRENTCOLUMN$$,11,12 )
but this is still giving me the milisecond.
Output using this function is : “2021-07-06 12:17:57.908”
Hi @hdonga, this is because the third parameter of this particular substr function is the length and you don’t want to take 12 characters starting at position 11
You could try substr($$CURRENTCOLUMN$$,0 ,10 ) + ’ ’ + substr($$CURRENTCOLUMN$$,11,8)
An alternative approach for converting datetime strings between formats would be to convert string to a datetime using String to Date&Time (giving the input format) and then Date&Time to String giving the output format, but I can see why you might want to do this as a single node.