How can I set time between 8am-12pm and 1pm-4pm
Enable the time picker between the alloted time
Eg…
If call clock now pattern HH:mm:ss a is greater than 8:00:00 am and call clock now pattern HH:mm:ss a is less than 12:00:00 p
Then set time picker enable to true
Else call notifier to alert
Thanks I will try this now
You may try this simple script that I have written for my own project. Just modify as per your requirement and host it anywhere on the web, then call the script.
Lastly, scrap the time from output.
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Online Clock</title>
<link rel="stylesheet" href="./style.css">
<style>
body {background-color:#2d2d2d;}
#timedate {
font: small-caps lighter 43px/150% "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif;
text-align:left;
width: 50%;
margin: 40px auto;
color:#fff;
border-left: 3px solid #ed1f24;
padding: 20px;
}
</style>
</head>
<body>
<!-- partial:index.partial.html -->
<body onLoad="initClock()">
<div id="timedate">
<a id="mon">January</a>
<a id="d">1</a>,
<a id="y">0</a><br />
<a id="h">12</a> :
<a id="m">00</a>:
<a id="s">00</a>:
<a id="mi">000</a>
</div>
<!-- partial -->
<script src="./script.js"></script>
</body>
<script>
// START CLOCK SCRIPT
Number.prototype.pad = function(n) {
for (var r = this.toString(); r.length < n; r = 0 + r);
return r;
};
function updateClock() {
var now = new Date();
var milli = now.getMilliseconds(),
sec = now.getSeconds(),
min = now.getMinutes(),
hou = now.getHours(),
mo = now.getMonth(),
dy = now.getDate(),
yr = now.getFullYear();
var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var tags = ["mon", "d", "y", "h", "m", "s", "mi"],
corr = [months[mo], dy, yr, hou.pad(2), min.pad(2), sec.pad(2), milli];
for (var i = 0; i < tags.length; i++)
document.getElementById(tags[i]).firstChild.nodeValue = corr[i];
}
function initClock() {
updateClock();
window.setInterval("updateClock()", 1);
}
// END CLOCK SCRIPT
</script>
</html>
OUTPUT
still error. limit time is 8:00am - 12:00pm and 1:00pm - 3:00pm but still accept 4:00pm schedule time.
here is our clock
It would be nice, in any topic, to credit solution to the person who gave it
Thanks so much for the help
Your method is easily hackable just by adjusting system time. So better call online time
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.