I have a date time object that is getting returned from a database with no associated timezone data (YYYY-MM-DD HH:MM:SS.mmmm). I know the information is in the America/New_York timezone.
But since there is no timezone with the date/time, when I try to save it in a format with a timezone it uses UTC.
When trying to save it in the correct timezone using Timex the time value changes by the offset and is no longer correct.
For example I have a datetime of ‘2017-03-08T17:04:10’ in the database that gets converted to #DateTime(2017-03-08T17:04:10Z Etc/UTC)
I want it to be changed to #DateTime(2017-03-08T17:04:10-05:00 America/New_York)
IE the numbers for year and time are all the same, but the timezone is different.
I thought about just appending the ‘-05:00’ and reparsing the string using Timex format/parse, but I want it to work with daylight savings time.
I haven’t been able to locate the Timex functionality to do this. Does anyone know if it exists?