Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Time Zone Diff in ASP

Posted on 2001-08-03
6
Medium Priority
?
285 Views
Last Modified: 2012-05-04
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.
0
Comment
Question by:TenTonJim
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 5

Expert Comment

by:nilapenn
ID: 6348235
use datediff function

response.write datediff("h",atlantadate,seattledate)
0
 
LVL 2

Author Comment

by:TenTonJim
ID: 6348934
how do I get the 2 in the code to compare?

sorry don't mean to be ignorant...

Thanks,
Jim S.
0
 
LVL 9

Accepted Solution

by:
msdixon earned 200 total points
ID: 6349351
actually, you don't want to use datediff. that would show you the difference. use datadd:
DateAdd(interval, number, date)
see:
http://msdn.microsoft.com/scripting/default.htm?/scripting/vbscript/doc/vsfctDateAdd.htm

response.write dateadd("h", -3, now())
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 5

Expert Comment

by:dgorin
ID: 6350046
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";
   else
      s += tz / 60 + " hours after GMT";
   return(s);
}
0
 
LVL 2

Author Comment

by:TenTonJim
ID: 6352495
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

Thanks,
Jim S.
0
 
LVL 2

Author Comment

by:TenTonJim
ID: 6352770
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.


Thanks,
Jim S.

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question