Solved

Is within time range?

Posted on 2011-09-21
1
174 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:
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Video Tutorial help 2 51
Why is my $_POST not going to results page 10 68
Where is this content coming from? 4 40
How do I refresh ajax data from controller using angular? 3 21
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

739 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