Friday, October 17, 2014

Write A program to use of Date Function in javascript.


Write A program to use of Date Function in javascript.
Code : datefun.html

<html>
<body>
<script type="text/javascript">
var d=new Date();
document.write(Date());
document.write("<br> Date is : ");
document.write(d.getDate());
document.write("<br>Miliseconds from 1/1/1970 is : ");
document.write(d.getTime());
document.write("<br>Year is : ");
document.write(d.getFullYear());
document.write("<br> Month is : ");
document.write(d.getMonth());
document.write("<br> Hour is : ");
document.write(d.getHours());
document.write("<br>Convaert date into string : ");
document.write(d.toString());
document.write("<br>Today is : ");
var a=d.getDay();
switch(a)
{
case 0:
document.write("sunday");
break;
case 1:
document.write("monday");
break;
case 2:
document.write("tuesday");
break;
case 3:
document.write("wednesday");
break;
case 4:
document.write("thursday");
break;
case 5:
document.write("friday");
break;
case 6:
document.write("saturday");
break;
}
</script>
</body>
</html>

No comments: