Converting time to UTC - Accounting for daylight savings?

I am ingesting a date/time from an external system in the format “9/7/2022 6:38:10 AM”. The time is central time, which is UCT - 5, but come daylight savings, it will be -6.

If I insert the date/time as-is into Backendless it is treated as UTC, which will throw off date calculations as the time has been moved 5 or 6 hours, possibly changing the date.

I can add 5 or 6 hours to the time before inserting it, but I don’t know how to figure out if daylight savings is in effect. I could compare the current date to the known daylight savings dates and adjust based on that. That feels clunky, but maybe that’s the easiest.

Any easier or more creative ideas?

Tim

Hi Tim,

My understanding is the time assignment is done to avoid any date transformation with the timezone differences or daylight time changes (btw, the US will no longer change clocks as of this year). I know I suggested earlier to set the time to 23:59:00, however, it will be subject to date transformation due to daylight time changes. Setting the time to something late in the UTC zone is still a safe approach in my mind.

Mark

Hi @mark-piller,

Where did you see we won’t be changing clocks this year? There was an effort made but I don’t think it passed.

This is not the same issue as before. When I asked for help previously on DateTime (I hate working with datetimes) that was for an event, so 1 day was granular enough. These are transactions that need to be shown with the correct time, so I can’t fudge it like we did with the other datetime.

Tim

https://thehill.com/homenews/house/3571007-permanent-daylight-saving-time-hits-brick-wall-in-house/