Solved

Is within time range?

Posted on 2011-09-21
1
168 Views
Last Modified: 2012-06-27
Paypal is going to have an outage between 11:30PM PDT and 4:00AM PDT on Sept 24 and 25, 2011.

I want to be able to throw a dialog that notifies my customers that their purchases may not go through due to this outage and they must try again later.

How would I tell if the time, I know, using JavaScript, it will be the client's computer time, is between the time frame above?
0
Comment
Question by:EddieShipman
1 Comment
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 36575184
just convert it to milliseconds, it will become easier

var d1 = new Date();
d1.setDate(24);
d1.setMonth(8);
d1.setFullYear(2011);
d1.setHours(23);
d1.setMinutes(30);

var d2 = new Date();
d2.setDate(25);
d2.setMonth(8);
d2.setFullYear(2011);
d2.setHours(4);
d2.setMinutes(0);

var currentTime = new Date();
var currentTimeMS = currentTime.getTime();


if ( d1.getTime() < currentTimeMS && d2.getTime() > currentTimeMS )
{
   alert("this is the correct time");
}
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now