[thelist] JavaScript: Hours & Minutes
Warden, Matt
mwarden at odyssey-design.com
Sat Mar 10 15:09:28 CST 2001
> hi, i hope you can help me with this part of my script:
> =================================================================
> var hs
> if(hours >= 06 && minutes > 28)&&(hours <09 + minutes >30)
> =================================================================
> the goal for this script, is to make it show witch tv-program that runs
> BETWEEN 06:28 and 09:30, everything else than the "minutes" variabel work.
What you have is a little off:
(hours >= 06 && minutes > 28)
Will return false at 7:01. You see why? Because minutes is not greater than
28... it's 1. Now, the easiest way to do this is probably to use minutes only.
if (minutes > ((6 * 60) + 28) && minutes < ((9 * 60) + 30))
{
...
}
It might be even easier (depending on how you're getting the date/time) to use
milliseconds.
HTH,
--
mattwarden
mattwarden.com
More information about the thelist
mailing list