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.
Current UK time is British Summer Time (BST) which is one hour ahead of Other Countries. So this code wont work.
Hi, you would just add an additional hour to your (UK) timezone.