Here's a quickie little custom date object I just wrote....should do pretty much anyting you need.
Code:
<html>
<head>
<title>Date test</title>
<script>
function myDate() {
var months = ['January','February','March','April','May','June','July','August','September','October','November','December'];
var days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
var d = new Date("May 1, 1999 00:30:15");
this.epoch = d.getTime();
this.year2 = d.getYear();
this.year4 = d.getFullYear();
this.leap = (this.year4 % 400 == 0) ? true : (this.year4 % 4 == 0 && this.year4 % 100 != 0) ? true : false;
this.mnth = d.getMonth();
this.month = this.mnth + 1;
this.monthName = months[this.mnth];
this.dy = d.getDay();
this.day = this.dy + 1;
this.dayName = days[this.dy];
this.date = d.getDate();
this.hours24 = d.getHours();
this.hours12 = (this.hours24 == 0) ? 12 : (this.hours24 > 12) ? this.hours24-12 : this.hours24;
this.minutes = d.getMinutes();
this.seconds = d.getSeconds();
this.ampm = (this.hours24 == 0) ? "am" : (this.hours24 >= 12) ? "pm" : "am";
this.GMTstring = d.toGMTString();
this.offset = d.getTimezoneOffset();
}
</script>
</head>
<body>
<pre>
<script>
var today = new myDate();
document.write("<b>Property\tValue</b><br>-----------------------------------<br>");
for (var i in today) {
var tabstops = (i.length < 8) ? "\t\t" : "\t";
document.write(i + tabstops + today[i] + "<br>");
}
</script>
</pre>
</body>
</html>
Bookmarks