如何讀取Server端的時間區域設定

An alternative is to write a function to display the server's time zone name
dynamically instead of your hard-coded "GMT".  The server time zone name can
be obtained from the server's windows registry.  You may use "VB" or "SQL"
to read the registry value.  The key location is
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\Stan
dardName.

The following is an example of using SQL:
declare @TimeZoneName varchar(30)
exec master.dbo.xp_regread
'HKEY_LOCAL_MACHINE','SYSTEM\CurrentControlSet\Control\TimeZoneInformation',
'StandardName', @TimeZoneName OUT
select @TimeZoneName

However, it may be easier to use VB script to read the registry value.
Set WshShell = Server.CreateObject("WScript.Shell")
strValue=WshShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contr
ol\TimeZoneInformation\StandardName")
Set WshShell = nothing

原文地址:https://www.cnblogs.com/dimg/p/424444.html