Closed Tonyx97 closed 5 months ago
What DateTime does when you change the timezone is to keep the numeric epoch time constant and change the date-time components (date, hour, minute, ...) accordingly. Currently the only timezone that makes sense in csv files is the local timezone.
What I could do is to allow user to specify timezone as part of the string format. But that's a relatively big job. I have to find time to do it.
What DateTime does when you change the timezone is to keep the numeric epoch time constant and change the date-time components (date, hour, minute, ...) accordingly. Currently the only timezone that makes sense in csv files is the local timezone.
What I could do is to allow user to specify timezone as part of the string format. But that's a relatively big job. I have to find time to do it.
Oh okay, thanks for the reply, I guess I can simply use remove the date and use the timestamp I have in the csv as a workaround, it seems to be working fine although I need some extra conversions between date and timestamp.
@Tonyx97 ,
I implemented this in master. Now you can have a string like:
2024-06-19 13:32 GMT
Also see test/date_time_tester.cc
and DateTime documentation
Hi, I'm reading a csv2 (as a DataFrame where the index is a DateTime) where the index is DateTimeISO and UTC but when I read it using the library, it will convert the DateTime to local and if I try to change the timezone after reading to UTC then the time won't change, just the timezone. A sample from the csv file:
And the code I'm currently using.
If I place a breakpoint in the last line and check the values of the first index, I get 1672527600 instead of 1672531200 (because I assume it's converting it to local time, GMT+2) but after calling set_timezone, the time won't turn into 1672531200 which is the actual UTC time. My idea would be to allow the user to specify the default timezone when reading the CSV. Any idea how to solve this? Thanks.