Time Zone Diff in ASP

My server is in Atlanta, I am in Seattle.

What is the asp code for displaying the time difference? I am close but after midnight my time is off for a few hours until Seattle catches up ha ha!

Thanks everyone,
Jim S.
Who is Participating?
msdixonConnect With a Mentor Commented:
actually, you don't want to use datediff. that would show you the difference. use datadd:
DateAdd(interval, number, date)

response.write dateadd("h", -3, now())
use datediff function

response.write datediff("h",atlantadate,seattledate)
TenTonJimAuthor Commented:
how do I get the 2 in the code to compare?

sorry don't mean to be ignorant...

Jim S.
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Here is client-side code to determine the difference between the browser time and GMT to get you started (if I recall correctly it's snipped from the MS documentation).  You can put the browser time in a hidden form field and when you submit the page you can compare to the server time using the server VBScript myTime=Now()

You can put the server time in your browser page and do all the comparison client-side if you wish.

function timezone() {

   var d, tz, s = "The current local time is ";
   d = new Date();
   tz = d.getTimezoneOffset();
   if (tz < 0)
      s += tz / 60 + " hours before GMT";
   else if (tz == 0)
      s += "GMT";
      s += tz / 60 + " hours after GMT";
TenTonJimAuthor Commented:
ok let me look as the midnight hour approaches and see what happens...

so far msdixon is going to get the nod, this looks to be exactly what I wants

Jim S.
TenTonJimAuthor Commented:
Thank you very much!

Exact answer... very nice answer... 1 line of code that's a bonus!!

Thank you to the other folks that gave answers also. msdixon got the nod because all I had to do was plug it in and it worked right off the bat.

Jim S.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.