thanks
Jay
'**************************************
' Name: GetLocalTZ
' Description:Compute the local time zon
' e in minutes from GMT, agjusting for Day
' light Saving Time (DST), find the local
' time zone name
' By: Dror Saddan
'
' Inputs:An optional string which will h
' old the time zone name.
'
' Returns:The local time zone in minutes
' , the time zone name.
'
' Assumes:The time zone information is s
' et correctly.
'
' Side Effects:None.
'
'This code is copyrighted and has' limited warranties.Please see http://w
' ww.Planet-Source-Code.com/xq/ASP/txtCode
' Id.844/lngWId.1/qx/vb/scripts/ShowCode.h
' tm'for details.'**************************************
'***************************************
' *****************************
'* Returns the machine TZ as minutes fro
' m GMT
'* If the TZ is PST which is GMT-8 you w
' ill get -28880
'* The TZ is adjusted for DST
'* The name of the TZ is returned in the
' parameter strTZName
'* Written by Dror Saddan (drors@ietusa.
' com)
'* Date: April 4,1998
'***************************************
' *****************************
Function GetLocalTZ(Optional ByRef strTZName As String) As Long
Dim objTimeZone As TIME_ZONE_INFORMATION
Dim lngResult As Long
Dim i As Long
lngResult = GetTimeZoneInformation&(objTimeZone)
Select Case lngResult
Case 0&, 1&'use standard time
GetLocalTZ = -(objTimeZone.Bias + objTimeZone.StandardBias) *
60'into minutes
For i = 0 To 31
If objTimeZone.StandardName(i) = 0 Then Exit For
strTZName = strTZName & Chr(objTimeZone.StandardName(i))
Next
Case 2& 'use daylight savings time
GetLocalTZ = -(objTimeZone.Bias + objTimeZone.DaylightBias) * 60
'into minutes
For i = 0 To 31
If objTimeZone.DaylightName(i) = 0 Then Exit For
strTZName = strTZName & Chr(objTimeZone.DaylightName(i))
Next
End Select
End Function
Function TestTimeZone()
Dim strTZ As String
Debug.Print GetLocalTZ(strTZ)
Debug.Print strTZ
End Function
"Jay [Work]" <nos...@nospam.com> wrote in message
news:eD2yN2XF...@TK2MSFTNGP12.phx.gbl...
> How can I change the time zone with a script? or is there a free util out
> there I can pass parameters to make the change?
Hi
From command lie (Win2k/WinXP):
Control.exe TIMEDATE.CPL,,/Z (GMT-08:00) Pacific Time (US & Canada); Tijuana
alternatively:
RUNDLL32.EXE SHELL32.DLL,Control_RunDLL TIMEDATE.CPL,,/Z (GMT-08:00) Pacific
Time (US & Canada); Tijuana
where '(GMT-08:00) Pacific Time (US & Canada); Tijuana' is the timezone to be
set.
--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter
jay
"Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> wrote in message
news:3EBAF910...@hydro.com...
> From command lie (Win2k/WinXP):
>
> Control.exe TIMEDATE.CPL,,/Z (GMT-08:00) Pacific Time (US & Canada);
> Tijuana
>
> alternatively:
> RUNDLL32.EXE SHELL32.DLL,Control_RunDLL TIMEDATE.CPL,,/Z (GMT-08:00)
> Pacific Time (US & Canada); Tijuana
>
> where '(GMT-08:00) Pacific Time (US & Canada); Tijuana' is the timezone
> to be set.
This is pretty slick! What's this based on, any "Display" value from
underneath 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones'?
Is there a way to do a static zone based on one of the shorter values in
the time zone table?
What's this based on?
--
Please respond in the newsgroup so everyone may benefit.
http://dev.remotenetworktechnology.com
(email requests for support contract information welcomed)
----------
Microsoft's new UNIFIED Terminal Services Newsgroup:
news:microsoft.public.windows.terminal_services
> Torgeir Bakken (MVP) wrote:
>
> > From command lie (Win2k/WinXP):
> >
> > Control.exe TIMEDATE.CPL,,/Z (GMT-08:00) Pacific Time (US & Canada);
> > Tijuana
>
> This is pretty slick! What's this based on, any "Display" value from
> underneath 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones'?
> Is there a way to do a static zone based on one of the shorter values in
> the time zone table?
Hi
Yes, the "Display" value, and it looks like you can use the Std value in those
registry keys as well, this is equivalent with the line above:
Control.exe TIMEDATE.CPL,,/Z Pacific Standard Time