Make your own free website on Tripod.com
// Week_Of.js // 1.0 - r. lundy - 97 Nov 07 // - return the user's `Week of ` in Month_Name dd, ccyy // 2.0 - r. lundy - 2000 jan 08 // - NN4.7 displayed year = "100"! // How to contact the Author: rlundy@ican.net // Y2K tested - 07 Nov 97, by the author // this script does not crash when the year turns to `2000` // usage: in HTML file: // [optional formatting][/optional formatting] var oneDay = 1000 * 60 * 60 * 24; // 1000 milliseconds/sec * 60 seconds/minute * 60 minutes/hour * 24 hours/day = 1 Day // NOTE: `date.getMonth()` returns `0` for Jan, `1` for Feb, ..., `11` for Dec <------- function monthName(indX) { monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December"); return monthNames[indX]; } function ordinalName(indX) { ordinals = new Array("","st","nd","rd","th","th","th","th","th","th","th","th","th","th","th","th","th","th","th","th","th","st","nd","rd","th","th","th","th","th","th","th","st") return ordinals[indX]; } function century(year) { if (year <= 99 ) return "19"; else return ""; } function today(x) { return x.getDay(); } // main() now = new Date(); while (today(now) != 1) { now.setTime(now - oneDay); } thisYear = now.getYear(); if(thisYear < 1900) {thisYear += 1900}; document.write(monthName(now.getMonth()) + " " + now.getDate() + ordinalName(now.getDate()) + ", " + century(now.getYear()) + thisYear); // the end