How to Customize Local Time and Date in WebSitePanel

Written by Naveed Ashraf Tuesday, 18 January 2011

Applied on: Windows Hosting.

The server at arvixe.com (and for others too) shows date time as per their physical location. Many webmasters (like me), require date time value as per my own location. This ASP script will get the GMT date time value from the server and add 5 hours, as per my GMT change.

<%

‘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

%>

Hope this will helps people searching for such script.


Leave a Reply






× 2 = sixteen