Date Let's see an example:
<HTML><HEAD><TITLE>Show
Date</TITLE></HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
var x= new Date();
document.write (x);
</SCRIPT>
</BODY></HTML>
To activate a Date Object, you can do this: var x=new Date(). Whenever
you want to create an instance of the date object, use this important
word: new followed by the object name().
Dynamically display different pages You can display different
pages according to the different time. Here is an example:
var banTime= new Date();
var ss=banTime.getHours();
if (ss<=12)
document.write("<img src='banner1.gif'>");
else
document.write("<img src='banner2.gif'>");
Date object
Methods |
getDate
getTime
getTimezoneOffset
|
getDay
getMonth
getYear |
getSeconds
getMinutes
getHours |
|