Page 1 of 1

1 liner to get time zone offset (tz database)

Posted: October 7th, 2012, 3:26 pm
by hamster
Hello folks, i am wondering if there is C function to convert a datetime+timezone to another time zone. something similar to mysql's convert_tz function, e.g.select convert_tz('2011-06-30 20:20:00','US/Eastern','GMT');... returns '2011-07-01 00:20:00' ...is there anything similar in C? I mean something really simple. It can also also return the offset between two time zones for a given date.

1 liner to get time zone offset (tz database)

Posted: October 7th, 2012, 4:08 pm
by Cuchulainn
Maybe Boost Date and Time?Maybe not 1-liner, but not far off

1 liner to get time zone offset (tz database)

Posted: October 7th, 2012, 5:42 pm
by hamster
QuoteOriginally posted by: CuchulainnMaybe Boost Date and Time?Maybe not 1-liner, but not far offthanks// triangle from EST to UTC to Arizona timet2 = us_arizona::utc_to_local( us_eastern::local_to_utc( t1 ) );i just talked to friend (a chemist) and we agreed to abolish time zones... b/c the people would get used to it...

1 liner to get time zone offset (tz database)

Posted: October 7th, 2012, 6:02 pm
by Cuchulainn
You're welcome. It is a 1-liner.Does your chemist friend have any ideas on how to abolish time itself?

1 liner to get time zone offset (tz database)

Posted: October 7th, 2012, 8:07 pm
by hamster
QuoteOriginally posted by: CuchulainnYou're welcome. It is a 1-liner.Does your chemist friend have any ideas on how to abolish time itself? i will ask him next time.that is likely to be very long symmetric vs irreversible answer... if it works I will tell you yesterday