digital clock
birthday= new Date();
birthday= new Date("june 20,2002 08:00:00");
birthday=new Date("6,20,2002");
setMonth() set the month, month number is 0 to 11;
setFullYear() set full year.
setTime() set the time.
setHours(),setMinutes(),setSeconds() set the time.
getMonth() get the month, month number is 0 to 11;
getFullYear() get full year.
getTime() get the time.
getHours(),getMinutes(),getSeconds() get the time.
birthday= new Date("june 20,2002 08:00:00");
birthday=new Date("6,20,2002");
Setting Date values.
setDate() set the date of month;setMonth() set the month, month number is 0 to 11;
setFullYear() set full year.
setTime() set the time.
setHours(),setMinutes(),setSeconds() set the time.
Getting date values.
getDate() get the date of month;getMonth() get the month, month number is 0 to 11;
getFullYear() get full year.
getTime() get the time.
getHours(),getMinutes(),getSeconds() get the time.
<html>
<head>
<style>
#circle
{
display: none;
margin-top:100px;
height:200px;
width:200px;
border:2px solid green;
border-radius:100px;
background-color:aquamarine;
background-image: radial-gradient( circle, green,white,green);
}
#time
{
height:30px;
width:200px;
position: relative;
top:70px;
color:darkblue;
font-weight: bold;
font-size:30px;
}
#date
{
height:10px;
width:200px;
position:relative;
top:20px;
color:darkblue;
font-weight:bold;
}
#day
{
height:10px;
width:100px;
position:relative;
top:90px;
color:darkblue;
font-weight:bold;
}
i
{
position: relative;
top:100px;
font-size:10px;
}
</style>
</head>
<body onload="myWatch()">
<script>
setInterval(myWatch,500);
function myWatch()
{
var time= new Date();
var hr=time.getHours();
var min = time.getMinutes();
var sec = time.getSeconds();
ab=(hr>12) ?" <span> PM</span>" : "<span>AM </span>";
hr = (hr == 0) ? 12 : hr;
hr = (hr > 12) ? hr - 12 : hr;
sec=(sec<10)? "0"+sec: sec;
hr=(hr<10)? "0"+hr:hr;
min=(min<10)? "0"+min :min;
document.getElementById("time").innerHTML = hr + ":" + min + ":" + sec + " "+ab;
var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
var date=new Date();
var dd=date.getDate();
var mm=months[date.getMonth()+1];
var yy=date.getFullYear();
document.getElementById("date").innerHTML=dd+"-"+mm+"-"+yy;
var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
var day=new Date();
var ddd=days[day.getDay()];
document.getElementById("day").innerHTML=ddd;
}
</script>
<center>
<div id="circle" >
<div id="time"></div>
<div id="date">
</div>
<div id="day">
</div>
<i> develop by @nke...</i>
</div>
</center>
</body>
</html>
<head>
<style>
#circle
{
display: none;
margin-top:100px;
height:200px;
width:200px;
border:2px solid green;
border-radius:100px;
background-color:aquamarine;
background-image: radial-gradient( circle, green,white,green);
}
#time
{
height:30px;
width:200px;
position: relative;
top:70px;
color:darkblue;
font-weight: bold;
font-size:30px;
}
#date
{
height:10px;
width:200px;
position:relative;
top:20px;
color:darkblue;
font-weight:bold;
}
#day
{
height:10px;
width:100px;
position:relative;
top:90px;
color:darkblue;
font-weight:bold;
}
i
{
position: relative;
top:100px;
font-size:10px;
}
</style>
</head>
<body onload="myWatch()">
<script>
setInterval(myWatch,500);
function myWatch()
{
var time= new Date();
var hr=time.getHours();
var min = time.getMinutes();
var sec = time.getSeconds();
ab=(hr>12) ?" <span> PM</span>" : "<span>AM </span>";
hr = (hr == 0) ? 12 : hr;
hr = (hr > 12) ? hr - 12 : hr;
sec=(sec<10)? "0"+sec: sec;
hr=(hr<10)? "0"+hr:hr;
min=(min<10)? "0"+min :min;
document.getElementById("time").innerHTML = hr + ":" + min + ":" + sec + " "+ab;
var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
var date=new Date();
var dd=date.getDate();
var mm=months[date.getMonth()+1];
var yy=date.getFullYear();
document.getElementById("date").innerHTML=dd+"-"+mm+"-"+yy;
var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
var day=new Date();
var ddd=days[day.getDay()];
document.getElementById("day").innerHTML=ddd;
}
</script>
<center>
<div id="circle" >
<div id="time"></div>
<div id="date">
</div>
<div id="day">
</div>
<i> develop by @nke...</i>
</div>
</center>
</body>
</html>
Thanks
ReplyDelete