I have a date that comes in as "2019-05-16T09:30:00-04:00" as an example. (I wont know the timezone in advance)
In the example above it is -4:00 from UTC
2019-05-16 09:30:00 - 04:00
According to this chart https://savvytime.com/converter/utc-to-cst
adding 4 hours to 09:30:00 gives me 13:30 (or 8:30 AM converted to cst)
My question is how do I get the incoming date to the actual CST time.
Code: Select all
const char *time_details = "2019-05-16T09:30:00-04:00"; struct tm tm2; strptime(time_details, "%Y-%m-%dT%H:%M:%S%z", &tm2); time_t tmIncomingTime = mktime(&tm2); struct tm * tmLocalTime = localtime(&tmIncomingTime); time_t t3 = mktime(tmLocalTime);
How can I get this converting the timezones with the correct time.
Thanks in advance.