I am trying programmatically check if the current time for my web application is between two predefined times. I don't know how to get the current time and then set variables that store two predefined times. The pseudo code would look like this
if(currentTime < shiftStart && currentTime <shiftEnd)
{
shift = 2
}
But how do I declare and setup the variables so the code works correctly.
var now = Date.now();
var time1 = //whatever time1 is
var time2 = //whatever time2 is
if (now > time1 && now < time2)
{
alert("blah"):
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With