timezone difficulty Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Thu Jun 26, 2008 8:50 pm

timezone difficulty

Post by rodrigod » Mon Apr 06, 2009 2:36 pm

i am having what I think is a simple problem. I just can't seem to find a way to get the local time zone. I need the difference between the local timezone and the UTC, but I didn't find a function on wxdatetime that could do something similar.

To explain exactly what I am doing, is I receive a long that is a C time and must return a Basic time. I have the equation but there is a varible on the equation that is windows only that I cant find a simple way to find it.

Here is the equation:

Code: Select all

dTime = (float)lTimeC / (3600 * 24) + 25569 - (float)(( _timezone  / 3600 ) - _daylight) / 24;
_timezone is the difference in seconds between the local time zone and UTC. And _daylight is if there is a DST difference to consider.


Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 207
Joined: Sat Jul 21, 2007 12:17 pm

Post by spectrum » Mon Apr 06, 2009 4:20 pm

hi rodrigod,

try this:

int hour = wxDateTime::Now().ToUTC().GetHour();

timezone = wxDateTime::Now().GetHour() - hour;
timezone *= 3600;


Post Reply