Serving the Quantitative Finance Community

 
User avatar
hamster
Topic Author
Posts: 1
Joined: October 12th, 2008, 3:51 pm

1 liner to get time zone offset (tz database)

October 7th, 2012, 3:26 pm

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.
Last edited by hamster on October 6th, 2012, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 20252
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

1 liner to get time zone offset (tz database)

October 7th, 2012, 4:08 pm

Maybe Boost Date and Time?Maybe not 1-liner, but not far off
 
User avatar
hamster
Topic Author
Posts: 1
Joined: October 12th, 2008, 3:51 pm

1 liner to get time zone offset (tz database)

October 7th, 2012, 5:42 pm

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...
Last edited by hamster on October 6th, 2012, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 20252
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

1 liner to get time zone offset (tz database)

October 7th, 2012, 6:02 pm

You're welcome. It is a 1-liner.Does your chemist friend have any ideas on how to abolish time itself?
 
User avatar
hamster
Topic Author
Posts: 1
Joined: October 12th, 2008, 3:51 pm

1 liner to get time zone offset (tz database)

October 7th, 2012, 8:07 pm

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