SERVING THE QUANTITATIVE FINANCE COMMUNITY

 
User avatar
hamster
Topic Author
Posts: 216
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: 60518
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

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
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
 
User avatar
hamster
Topic Author
Posts: 216
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: 60518
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

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?
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
 
User avatar
hamster
Topic Author
Posts: 216
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
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On