I get date and time values from a web server.
I converted thees values to wxDateTime, but this server returns dates in GMT.
How to convert those values to my local time?
GMT to local time
Re: GMT to local time
Was there any issues with methods described in the section Time Zone and DST Support of wxDateTime docs?
Edit
I did not really test it but something like this may work
Please notice the word "may", these things can get tricky. IIRC there was a timezone related bug in wxWidgets not that long ago, but I may be confusing it with something else...
Edit
I did not really test it but something like this may work
Code: Select all
// this pretends to be the datetime from the server in the UTC
wxDateTime dtUTC = wxDateTime::Now();
// calc the difference between the UTC and the local tz
wxTimeSpan ts = dtUTC.Subtract(dtUTC.ToUTC());
// now offset the datetime by the difference
wxDateTime dtLocal = dtUTC + ts;
Re: GMT to local time
yes, this code works OK.
+3 hours (Moscow time)
Thank you VERY MUCH
+3 hours (Moscow time)
Thank you VERY MUCH