Soren Winslow
Time Zone Adjustment Utility
If your server is in the Eastern time Zone and you are in the Pacific time zone, and you would like to get some accurate times without having to think as much. For example, you are keeping some kind of page hit log and you would like to see the time/date stamp in your time zone instead of the servers time zone. Here is a list of hourly fractions to add or subtract to the the function Now() to get a more accurate time.
There are two different ways that you can add or subtract hours to the current server time. You can simply use the VBScript DateAdd() function or you can also add the hourly decimal equivalent to the server time (shown as Now())
This script should also help you determine what timezone your server is in by counting the hour differences between Now() and yoru local time. If Now() is aproximately the same as the time on your computer then you are in the same timezone as your server.

Here is the ASP code for this script:

<%



  CurrentTime = Now()

  Response.Write "<b>Current Server Time : " & _

                 CurrentTime & _

                 "</b><br>"



  Response.Write "<table border=" & chr(34) & "1" & chr(34) & " " & _

                         "cellspacing=" & chr(34) & "0" & chr(34) & ">" & _

                 "<tr class=" & chr(34) & "breg" & chr(34) & " " & _

                      "style=" & chr(34) & "text-align:center;" & chr(34) & ">" & _

                 "<td><b>Hours</b></td>" & _

                 "<td><b>Time</b></td>" & _

                 "<td><b>DateAdd() Formula</b></td>" & _

                 "<td><b>Decimal Formula</b></td>" & _

                 "</tr>"



  For x = 23 to 1 step -1

     HourDecimal = FormatNumber(x/24,5)



     Response.Write "<tr class=" & chr(34) & "breg" & chr(34) & ">" & _

                    "<td>-" & x & "</td>" & _

                    "<td>" & DateAdd("h",x*-1,CurrentTime) & "</td>" & _

                    "<td>DateAdd(" & chr(34) & "h" & chr(34) & "," & x*-1 & ",Now())</td>" & _

                    "<td>Now()-" & HourDecimal & "</td>" & _

                    "</tr>"





  Next







   Response.Write "<tr class=" & chr(34) & "breg" & chr(34) & ">" & _

                  "<td><b>0</b></td>" & _

                  "<td><b>" & CurrentTime & "</b></td>" & _

                  "<td colspan=" & chr(34) & "2" & chr(34) & " " & _

                       "style=" & chr(34) & "text-align:center" & chr(34) & ">" & _

                       "<b>Now()</b>" & _

                  "</td>" & _

                  "</tr>"





  For x = 1 to 23

     HourDecimal = FormatNumber(x/24,5)



     Response.Write "<tr class=" & chr(34) & "breg" & chr(34) & ">" & _

                    "<td>-" & x & "</td>" & _

                    "<td>" & DateAdd("h",x,CurrentTime) & "</td>" & _

                    "<td>DateAdd(" & chr(34) & "h" & chr(34) & "," & x & ",Now())</td>" & _

                    "<td>Now()+" & HourDecimal & "</td>" & _

                    "</tr>"





  Next



  Response.Write "</table>"





  %>

               

Here is the running script:
Current Server Time : 7/31/2014 6:28:20 AM
HoursTimeDateAdd() FormulaDecimal Formula
-237/30/2014 7:28:20 AMDateAdd("h",-23,Now())Now()-0.95833
-227/30/2014 8:28:20 AMDateAdd("h",-22,Now())Now()-0.91667
-217/30/2014 9:28:20 AMDateAdd("h",-21,Now())Now()-0.87500
-207/30/2014 10:28:20 AMDateAdd("h",-20,Now())Now()-0.83333
-197/30/2014 11:28:20 AMDateAdd("h",-19,Now())Now()-0.79167
-187/30/2014 12:28:20 PMDateAdd("h",-18,Now())Now()-0.75000
-177/30/2014 1:28:20 PMDateAdd("h",-17,Now())Now()-0.70833
-167/30/2014 2:28:20 PMDateAdd("h",-16,Now())Now()-0.66667
-157/30/2014 3:28:20 PMDateAdd("h",-15,Now())Now()-0.62500
-147/30/2014 4:28:20 PMDateAdd("h",-14,Now())Now()-0.58333
-137/30/2014 5:28:20 PMDateAdd("h",-13,Now())Now()-0.54167
-127/30/2014 6:28:20 PMDateAdd("h",-12,Now())Now()-0.50000
-117/30/2014 7:28:20 PMDateAdd("h",-11,Now())Now()-0.45833
-107/30/2014 8:28:20 PMDateAdd("h",-10,Now())Now()-0.41667
-97/30/2014 9:28:20 PMDateAdd("h",-9,Now())Now()-0.37500
-87/30/2014 10:28:20 PMDateAdd("h",-8,Now())Now()-0.33333
-77/30/2014 11:28:20 PMDateAdd("h",-7,Now())Now()-0.29167
-67/31/2014 12:28:20 AMDateAdd("h",-6,Now())Now()-0.25000
-57/31/2014 1:28:20 AMDateAdd("h",-5,Now())Now()-0.20833
-47/31/2014 2:28:20 AMDateAdd("h",-4,Now())Now()-0.16667
-37/31/2014 3:28:20 AMDateAdd("h",-3,Now())Now()-0.12500
-27/31/2014 4:28:20 AMDateAdd("h",-2,Now())Now()-0.08333
-17/31/2014 5:28:20 AMDateAdd("h",-1,Now())Now()-0.04167
07/31/2014 6:28:20 AMNow()
-17/31/2014 7:28:20 AMDateAdd("h",1,Now())Now()+0.04167
-27/31/2014 8:28:20 AMDateAdd("h",2,Now())Now()+0.08333
-37/31/2014 9:28:20 AMDateAdd("h",3,Now())Now()+0.12500
-47/31/2014 10:28:20 AMDateAdd("h",4,Now())Now()+0.16667
-57/31/2014 11:28:20 AMDateAdd("h",5,Now())Now()+0.20833
-67/31/2014 12:28:20 PMDateAdd("h",6,Now())Now()+0.25000
-77/31/2014 1:28:20 PMDateAdd("h",7,Now())Now()+0.29167
-87/31/2014 2:28:20 PMDateAdd("h",8,Now())Now()+0.33333
-97/31/2014 3:28:20 PMDateAdd("h",9,Now())Now()+0.37500
-107/31/2014 4:28:20 PMDateAdd("h",10,Now())Now()+0.41667
-117/31/2014 5:28:20 PMDateAdd("h",11,Now())Now()+0.45833
-127/31/2014 6:28:20 PMDateAdd("h",12,Now())Now()+0.50000
-137/31/2014 7:28:20 PMDateAdd("h",13,Now())Now()+0.54167
-147/31/2014 8:28:20 PMDateAdd("h",14,Now())Now()+0.58333
-157/31/2014 9:28:20 PMDateAdd("h",15,Now())Now()+0.62500
-167/31/2014 10:28:20 PMDateAdd("h",16,Now())Now()+0.66667
-177/31/2014 11:28:20 PMDateAdd("h",17,Now())Now()+0.70833
-188/1/2014 12:28:20 AMDateAdd("h",18,Now())Now()+0.75000
-198/1/2014 1:28:20 AMDateAdd("h",19,Now())Now()+0.79167
-208/1/2014 2:28:20 AMDateAdd("h",20,Now())Now()+0.83333
-218/1/2014 3:28:20 AMDateAdd("h",21,Now())Now()+0.87500
-228/1/2014 4:28:20 AMDateAdd("h",22,Now())Now()+0.91667
-238/1/2014 5:28:20 AMDateAdd("h",23,Now())Now()+0.95833
© 1967 - 2014 Soren Winslow