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

x
?
Solved

Is within time range?

Posted on 2011-09-21
1
Medium Priority
?
178 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
[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
1 Comment
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 2000 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 Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…

715 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