Show the current date
For example:
<script language="JavaScript">
<!--
function TodayIs(sText)
{
var aDays = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday","Saturday");
var aMonths = new Array("January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December");
var date = new Date();
if (sText != "")
document.write(sText + " ");
document.write("<i>");
document.write(aDays[date.getDay()] + ", ");
document.write(aMonths[date.getMonth()] + " ");
document.write(date.getDate() + ", ");
if (date.getYear() > 1000)
document.write(date.getYear());
else
{
if (date.getYear() > 90 && date.getYear() < 100)
document.write("19" + date.getYear());
else
{
if (date.getYear() > 99)
document.write(date.getYear() + 1900);
}
}
document.writeln(" </i>");
}
// -->
</script>
<script language="javascript">
// Example of use
TodayIs("Today's date is:");
</script>
|