|Get local time|
In this tutorial we will consider our server is located in a different time zone from the one our clients are located at (A London related site is in a server located is USA for example).
First we must know the time in the server. We will create a text file with the code bellow, and we will copy it to our server:
Time in server: <% =time %>
Then we will visit our page and we will get the time in the server. In our case the output is this one
Time in server: 4:14:09 AM
Second, we will calculate the difference in hours between local time and time in server
In our example, in London the time is 10:14:09, so the difference between time in london and in server is six hours.
Finally we will get the code necessary to display the local time by
adding 6 hours to server´s time.
thehour=Hour(now) 6 ' Here we will add 6 to hour in server
if thehour>12 then
if Theminute<10 then
Theminute="0" & Theminute
if Thesecond<10 then
Thesecond="0" & Thesecond
Local time: <% =thehour %>:<% =Theminute %>:<% =Thesecond %>
Local time: 10:14:09