Is there a way of being able to find the time and DST in another time
zone from within an application other than by going into control panel
and effectively moving your entire PC to another time zone using 'date
and time'?
Also is there a way of getting a list of all the various time zones in
the world rather than just being able to get the name of the time zone
that your PC is currently set to (using the _get_tzname and
_get_timezone functions)?
Many thanks in advance,
'Newsgroupie'
England
To get the time for another zone do something like this.
Let say t is the current local time.
Then get offset of the current time zone from the registry. Lets say
your current timezone is GMT + 5:30 (IST)
Now, you want time in US (Eastern time - US & Canada) which is GMT - 5:00
So, the time in US will be
t2 = t1 - (5:30 - (-5:00))
There might be some API also, but I am not aware of them. If there are
any, hope someone will reply...:)
Regards,
Ashutosh Bhawasinka
Fortunately, there is an API: SystemTimeToTzSpecificLocalTime()
Be aware though that this API has serious limitations if you want to use it
for 'old' timestamps, iow timestamps from previous DST periods (such as last
year or before).
HTH,
Serge.
http://www.apptranslator.com - Localization tool for your MFC applications
"Ashutosh Bhawasinka" <discu...@ashutosh.in> wrote in message
news:OOOT%23kuFJ...@TK2MSFTNGP03.phx.gbl...
Please keep it coming!
:-)
'Newsgroupie'
England
I have a system where the logical 'end of day' is 5am the next morning. Unfortunately, the customer is in a different timezone from
me and they have dst and I don't. Their dst time changes at 2am.
When testing, I don't want to change the time on my computer, as it messes up so many things, not least Visual Studio.
When testing, I tear my hair out adding 5 subtracting 2 (or is it 3) when dst starts and finishes.
But as already pointed out, there is no simple solution (I found out somewhere along the
line that one of the Australian states has DST only every-other-year because that's the
year of some important festival and they want extra time at night to celebrate. It may
have even been in this newsgroup someone pointed that out)
joe
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm