LunarPages美国主机商,提供linux虚拟主机,windows虚拟主机,VPS以及独立主机全线产品LunarPages还提供PayPal,E-gold,Netteller,MoneyBookers等多种付款方式,极大的方便国际客户。

大家在LunarPages主机空间安装程序是可能显示的是国外时间,也就是服务器上面的时间,由于我们使用的是虚拟主机,所以不能更改服务器上面的时间,那边我们又该如何更改系统时间为北京时间呢?其实方法很简单,就是在你ASP脚本中添加调用时间的函数就可以了,具体代码如下所示:

<% ‘assigin gmt time difference with local to variable my_gmt_diff = +5 ‘ get current datetime of server od = now() ‘server has location information so we get gmt time as per location

set oShell = CreateObject(“WScript.Shell”)

atb = “HKEY_LOCAL_MACHINE\System\CurrentControlSet\” &_

“Control\TimeZoneInformation\ActiveTimeBias”

offsetMin = oShell.RegRead(atb)

nd = dateadd(“n”, offsetMin, od)

my_local_datetime    = dateadd(“h”,my_gmt_diff,nd) ‘ to save on database (mm/dd/yyyy)

Response.Write my_local_datetime

%>

通过以上设置就可以更改系统时间为北京时间了,以上代码适用于Windows系统主机,如果大家是Linux系统,可以在.htaccess配置文件中进行设置,具体的方法大家可以去美国主机侦探论坛看看。

zp8497586rq