inherit
72555
0
Feb 10, 2007 22:01:53 GMT -8
mashimaro
43
February 2006
mashimaro
|
Post by mashimaro on Feb 6, 2007 13:31:02 GMT -8
|
|
inherit
70565
0
Sept 26, 2018 5:22:43 GMT -8
Marc
4,107
January 2006
cr0w
|
Post by Marc on Feb 7, 2007 13:28:20 GMT -8
Can you please open your forum to guests so we can see?
|
|
inherit
72555
0
Feb 10, 2007 22:01:53 GMT -8
mashimaro
43
February 2006
mashimaro
|
Post by mashimaro on Feb 7, 2007 16:53:17 GMT -8
sry its open
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,870
December 2005
horace
|
Post by Chris on Feb 8, 2007 1:35:59 GMT -8
There's a slight discrepancy since the code assumes each month has 30 days for the sake of simplicity. Try this modified code instead...
<script type="text/javascript"> <!-- /* add "forum age" to the info center http://101support.proboards43.com - ross */ var startDate = ['11','02','2006']; // Forum start date in the form ['day','month','year']
// no need to edit below if(location.href.match(/\.com\/?(index.cgi)?\??(&?action=home)?(#\w+)?$/)) { var cur = new Date(); var td = document.getElementsByTagName('td'); var sta = new Date(); sta.setDate(startDate[0]); sta.setMonth(startDate[1]-1); sta.setYear(startDate[2]); var curMonth=parseInt(startDate[1]-1); var curYear=parseInt(startDate[2]); var leap=0; var dif = cur - sta; var totalMonth = 0; var totalYear = 0; var totalDay = Math.floor(dif/(60 * 60 * 24 * 1000))+1 ; while(totalDay-1 >= 365) { totalDay -= 365; totalYear++; getMonthDays(1,curYear) //check leap year curYear++; } var monthDays=getMonthDays(curMonth,curYear); while(totalDay >= monthDays) { totalDay -= monthDays; totalMonth++; curMonth++; if(curMonth==12){curMonth=0; curYear++} if(totalMonth==12){totalMonth=0; totalYear++} monthDays=getMonthDays(curMonth,curYear); } if((totalDay-leap)>-1){totalDay=totalDay-leap} var age = totalDay +' day'+((totalDay!=1)?'s':''); if(totalMonth > 0) age += ', '+ totalMonth +' month'+((totalMonth!=1)?'s':''); if(totalYear > 0) age += ', '+ totalYear +' year'+((totalYear!=1)?'s':''); age += '.'; for (i=td.length-1; i>0; i--) { if(td[i].width == '40%' && td[i-1].width == '60%') { td[i].firstChild.innerHTML += '<br />Forum Age: '+age; break; } } } function getMonthDays(month,year){ if(month==3||month==5||month==8||month==10){ return 30; }else if(month==1){ if(year%4==0 && (year%100!=0||year%400==0)){leap++; return 29;}else{return 28} }else{ return 31; } } //--> </script>
Edit: was one day off
|
|
inherit
72555
0
Feb 10, 2007 22:01:53 GMT -8
mashimaro
43
February 2006
mashimaro
|
Post by mashimaro on Feb 8, 2007 21:49:34 GMT -8
thks ... yea i know it was set for only 30 days for some month but i didnt know how to change the code. thks very much =)
|
|