Trouble to resolve a timezone offset to get correct UTC time
Hello, I am sorry, I am kind of lost and I would be really grateful to receive some help. Basically, I have a list of timestamps expressed as a strings as below, and I would like them expressed in UTC. But there seems to be a trouble during the offset, which is applied the other way round. The input timestamps look like: 0 'Sat Mar 30 2019 21:00:00 GMT+0100' Adding them in a panda dataframe with to_datetime function, they read then: GC['Time'] = pd.todatetime(my_timestamps) GC['Time'] 0 2019-03-30 21:00:00-01:00 If I further ask: GC['Time'][0] datetime.datetime(2019, 3, 30, 21, 0, tzinfo=tzoffset(None, -3600)) It seems, AFAIK, OK. But then if I want to resolve the offset so as to have time expressed in UTC time, I get: GC['Test'] = pd.to_datetime(GC['Time'],utc=True) 0 2019-03-30 22:00:00+00:00 The offset has bee applied the other way round. Correct timestamp in UTC would be 20:00:00 Please, what should I do to have these timestamps correctly expressed in UTC time? I thank you in advance for your help. I am so sorry to intrude the mailing list with this question, but I am unable to move forward from this point. I thank you again, Bests, Pierre
I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. https://bit.ly/3yc1A9G
participants (3)
-
annakirst@tutanota.com
-
isomsloan498@gmail.com
-
Pierre