Skip to main content
added 219 characters in body
Source Link
Jon Taylor
  • 7.9k
  • 5
  • 31
  • 55

if you use new Date().getTime(); this will return the number of miliseconds since a particulular time (this happens to be 1st January 1970).

If you do this for both your start and end time as well as your current time, if your current time lies between start and end then it will be greater than the start miliseconds and less than the end miliseconds.

Just a note, instead of Date().getTime(); you can actually do it as +new Date; something I learned from looking around the web. Google Wins again :). This is because the + essentially casts the date to an int.

if you use new Date().getTime(); this will return the number of miliseconds since a particulular time (this happens to be 1st January 1970).

If you do this for both your start and end time as well as your current time, if your current time lies between start and end then it will be greater than the start miliseconds and less than the end miliseconds.

if you use new Date().getTime(); this will return the number of miliseconds since a particulular time (this happens to be 1st January 1970).

If you do this for both your start and end time as well as your current time, if your current time lies between start and end then it will be greater than the start miliseconds and less than the end miliseconds.

Just a note, instead of Date().getTime(); you can actually do it as +new Date; something I learned from looking around the web. Google Wins again :). This is because the + essentially casts the date to an int.

Source Link
Jon Taylor
  • 7.9k
  • 5
  • 31
  • 55

if you use new Date().getTime(); this will return the number of miliseconds since a particulular time (this happens to be 1st January 1970).

If you do this for both your start and end time as well as your current time, if your current time lies between start and end then it will be greater than the start miliseconds and less than the end miliseconds.