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 : 3/29/2024 6:00:55 AM
HoursTimeDateAdd() FormulaDecimal Formula
-233/28/2024 7:00:55 AMDateAdd("h",-23,Now())Now()-0.95833
-223/28/2024 8:00:55 AMDateAdd("h",-22,Now())Now()-0.91667
-213/28/2024 9:00:55 AMDateAdd("h",-21,Now())Now()-0.87500
-203/28/2024 10:00:55 AMDateAdd("h",-20,Now())Now()-0.83333
-193/28/2024 11:00:55 AMDateAdd("h",-19,Now())Now()-0.79167
-183/28/2024 12:00:55 PMDateAdd("h",-18,Now())Now()-0.75000
-173/28/2024 1:00:55 PMDateAdd("h",-17,Now())Now()-0.70833
-163/28/2024 2:00:55 PMDateAdd("h",-16,Now())Now()-0.66667
-153/28/2024 3:00:55 PMDateAdd("h",-15,Now())Now()-0.62500
-143/28/2024 4:00:55 PMDateAdd("h",-14,Now())Now()-0.58333
-133/28/2024 5:00:55 PMDateAdd("h",-13,Now())Now()-0.54167
-123/28/2024 6:00:55 PMDateAdd("h",-12,Now())Now()-0.50000
-113/28/2024 7:00:55 PMDateAdd("h",-11,Now())Now()-0.45833
-103/28/2024 8:00:55 PMDateAdd("h",-10,Now())Now()-0.41667
-93/28/2024 9:00:55 PMDateAdd("h",-9,Now())Now()-0.37500
-83/28/2024 10:00:55 PMDateAdd("h",-8,Now())Now()-0.33333
-73/28/2024 11:00:55 PMDateAdd("h",-7,Now())Now()-0.29167
-63/29/2024 12:00:55 AMDateAdd("h",-6,Now())Now()-0.25000
-53/29/2024 1:00:55 AMDateAdd("h",-5,Now())Now()-0.20833
-43/29/2024 2:00:55 AMDateAdd("h",-4,Now())Now()-0.16667
-33/29/2024 3:00:55 AMDateAdd("h",-3,Now())Now()-0.12500
-23/29/2024 4:00:55 AMDateAdd("h",-2,Now())Now()-0.08333
-13/29/2024 5:00:55 AMDateAdd("h",-1,Now())Now()-0.04167
03/29/2024 6:00:55 AMNow()
-13/29/2024 7:00:55 AMDateAdd("h",1,Now())Now()+0.04167
-23/29/2024 8:00:55 AMDateAdd("h",2,Now())Now()+0.08333
-33/29/2024 9:00:55 AMDateAdd("h",3,Now())Now()+0.12500
-43/29/2024 10:00:55 AMDateAdd("h",4,Now())Now()+0.16667
-53/29/2024 11:00:55 AMDateAdd("h",5,Now())Now()+0.20833
-63/29/2024 12:00:55 PMDateAdd("h",6,Now())Now()+0.25000
-73/29/2024 1:00:55 PMDateAdd("h",7,Now())Now()+0.29167
-83/29/2024 2:00:55 PMDateAdd("h",8,Now())Now()+0.33333
-93/29/2024 3:00:55 PMDateAdd("h",9,Now())Now()+0.37500
-103/29/2024 4:00:55 PMDateAdd("h",10,Now())Now()+0.41667
-113/29/2024 5:00:55 PMDateAdd("h",11,Now())Now()+0.45833
-123/29/2024 6:00:55 PMDateAdd("h",12,Now())Now()+0.50000
-133/29/2024 7:00:55 PMDateAdd("h",13,Now())Now()+0.54167
-143/29/2024 8:00:55 PMDateAdd("h",14,Now())Now()+0.58333
-153/29/2024 9:00:55 PMDateAdd("h",15,Now())Now()+0.62500
-163/29/2024 10:00:55 PMDateAdd("h",16,Now())Now()+0.66667
-173/29/2024 11:00:55 PMDateAdd("h",17,Now())Now()+0.70833
-183/30/2024 12:00:55 AMDateAdd("h",18,Now())Now()+0.75000
-193/30/2024 1:00:55 AMDateAdd("h",19,Now())Now()+0.79167
-203/30/2024 2:00:55 AMDateAdd("h",20,Now())Now()+0.83333
-213/30/2024 3:00:55 AMDateAdd("h",21,Now())Now()+0.87500
-223/30/2024 4:00:55 AMDateAdd("h",22,Now())Now()+0.91667
-233/30/2024 5:00:55 AMDateAdd("h",23,Now())Now()+0.95833
© 1967 - 2024 Soren Winslow