Hallo! I’m new user in Knime.
today, I want to remove GMT on " Thu, 01 Dec 2022 23:28:01 GMT " and change it to Thu, 01 Dec 2022 23:28:01
Can you tell me how to remove the timezone on this date & time?
I want to use String Manipulation Nodes, but basically I have no understanding of programming so it makes me confused, can you tell me the code that can answer my case?
Hallo @ganieaku & welcome to the KNIME forum community !
This can be easily done with s -string Manipulation- node using the following instruction:
strip( replace( $date & time$, "GMT", ""))
I’m assuming here that the name of your column is “date & time” but please change the name if needed. The replace function replaces “GTM” by nothing “” and the strip() function removes any trailing blanks at the beginning and the end of the string.
Hope it helps.
after I followed your instructions I ran into a new problem. I want to convert String to Date&Time using String to Date Nodes, but I get an error like below
Configure on String to Date&Time Node
below is the code that I implemented in the String Manipulation Node
You didn’t mention that you wanted to convert the string into date&time although I should have guess it
Please use rather the following instruction in the -String Manipulation" node:
strip( substr( replace( $date & time$, "GMT", ""), 4))
In the -String to Data & Time- node you can costumize the Date & Time format.
In your case, I guess this is the one that should work:
dd MMM yyyy HH:mm:ss
Please enter it by hand (copy and paste from here) into the field “Date Format”. It should look like this:
Hope it helps.
@ganieaku would it be possible to remove the time zone?
Thankyou so much @aworker, your help is very useful for me
@mlauber71 Actually I want to try using it, but my data type is String. I tried but Node it doesn’t work on String data type, I want to change String to Date&Time but I assume that the main problem is I need to remove the timezone first.
@ganieaku you have to modify your string (Thu, 01 Dec 2022 23:28:01 GMT) to detect the Date & Time:
EEE, dd MMM yyyy HH:mm:ss zzz
kn_forum_49528_time_zone_gmt.knwf (10.4 KB)
Thanks @ganieaku for your kind comments.
@mlauber71 has just posted a more appropriate and generic solution to your question. I think it is the solution to go for
it’s a good news!!
Thankyou @mlauber71 .
I want to ask, does the Locale type in the Type and Format Selection have any effect? Suppose if I change to “ru-KZ”/other?
Sorry, I’m just trying to adapt to Node in Knime
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.