B
Brian
I need to be able to only allow my clients to enter data into a part
of a form between specific hours of the day. i can find tons of
articles on comparing dates, but not times. does anyone know how to
do this?
this is what i came up with, but its obviously not right. thanks in
advance
var a_p = "";
var d = new Date();
var curr_hour = d.getHours();
if (curr_hour < 12)
{
a_p = "AM";
}
else
{
a_p = "PM";
}
if (curr_hour == 0)
{
curr_hour = 12;
}
if (curr_hour > 12)
{
curr_hour = curr_hour - 12;
}
var curr_min = d.getMinutes();
curr_min = curr_min + "";
if (curr_min.length == 1)
{
curr_min = "0" + curr_min;
}
var curr_time = curr_hour +":"+curr_min+" "+a_p;
alert(curr_time);
if (curr_time > '8:59 AM' ) && (curr_time < '1:01 PM' ) {
alert("ok");
} else {
alert("nope");
}
of a form between specific hours of the day. i can find tons of
articles on comparing dates, but not times. does anyone know how to
do this?
this is what i came up with, but its obviously not right. thanks in
advance
var a_p = "";
var d = new Date();
var curr_hour = d.getHours();
if (curr_hour < 12)
{
a_p = "AM";
}
else
{
a_p = "PM";
}
if (curr_hour == 0)
{
curr_hour = 12;
}
if (curr_hour > 12)
{
curr_hour = curr_hour - 12;
}
var curr_min = d.getMinutes();
curr_min = curr_min + "";
if (curr_min.length == 1)
{
curr_min = "0" + curr_min;
}
var curr_time = curr_hour +":"+curr_min+" "+a_p;
alert(curr_time);
if (curr_time > '8:59 AM' ) && (curr_time < '1:01 PM' ) {
alert("ok");
} else {
alert("nope");
}