Quote:
Originally Posted by Old Pedant
Trouble is, JavaScript will *NOT* display Feb 29, 1900 or Feb 29, 2100.
If you do
Code:
var theDate = new Date( 1900, 1, 29 ); // 1 is February in JS code
document.write( theDate );
JavaScript *will* display "March 1, 1900" back at you.
So in order to display "Feb 29, 1900" you will have to not use JavaScript's Date() object *AT ALL* and essentially re-create the entire calendar system.
Of course it can be done. It's just a real pain in the patootie and you are asking a lot to have somebody write that all for you.
|
what I was thinking is doing this
year = days/365.25
Array MonthEnd(31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365)
DayOfYear = days - (year*365)
if year is divisible by 4 leap = yes (i don't know how to code that easily)
if leap
for i=1; i<12; i++
MonthEnd(i) = MonthEnd(i)+1
Switch
DayOfYear < MonthEnd[1]
Month = Jan
DayOfYear > MonthEnd[1] && DayOfYear < MonthEnd[2]
Month = Feb
Date = DayOfYear - MonthEnd[1]
Doc.write(Year Month Date)
Does this logic pan out? I'm not sure how switch works and I haven't gotten for loop to work for some reason when i tried it for something else