showing "posted X days ago"

Discuss news styles, css code, and other Coranto customizations in here...the possibilities are endless, so have at it!

Moderator: Spunkmeyer

Postby AndyP » Sat May 28, 2005 12:30 pm

InSAnE NiNjA wrote:umm.. remove..

Code: Select all
   else (daysDifference >= 1)
   document.write(' ');


Problem is when it gets past 20 hours it doesn't post anything but when it reaches tomorrow it starts posting the 'Posted XX hours ago' again... it's not handling the days right.
AndyP
 
Posts: 165
Joined: Wed Jan 10, 2007 10:10 pm

Postby AndyP » Sat May 28, 2005 2:00 pm

In fact on the front page of this site now they have 4 days ago and 5 days ago next to the first two stories posted. I wonder if a working version of that code could be posted here....
AndyP
 
Posts: 165
Joined: Wed Jan 10, 2007 10:10 pm

Postby InSAnE NiNjA » Sat May 28, 2005 2:59 pm

Code: Select all
<script language="javascript>function difference(oldtime) {
   var nowtime = new Date();
   var milliseconds1 = oldtime.getTime();
   var milliseconds2 = nowtime.getTime();
   var difference = milliseconds2 - milliseconds1;

   if (difference > 1000*60*60*6) break;

   var daysDifference = Math.floor(difference/1000/60/60/24);
   difference = difference - daysDifference*1000*60*60*24
   var hoursDifference = Math.floor(difference/1000/60/60);
   difference = difference - hoursDifference*1000*60*60
   var minutesDifference = Math.floor(difference/1000/60);
   difference = difference - minutesDifference*1000*60
   var secondsDifference = Math.floor(difference/1000);
//   document.write('This topic is ' + daysDifference + ' days, ' + hoursDifference + ' hours, ' + minutesDifference + ' minutes, and ' + secondsDifference + ' seconds old.');

if (daysDifference > 1 && hoursDifference > 6)
   document.write('This topic is ' hoursDifference + ' hours, and ' + minutesDifference + ' minutes old.');
}
</script>


there ya go
..nuttier then a squirrel turd..
User avatar
InSAnE NiNjA
 
Posts: 1213
Joined: Sat Jan 25, 2003 6:35 am

Postby AndyP » Sat May 28, 2005 4:17 pm

InSAnE NiNjA wrote:
Code: Select all
<script language="javascript>function difference(oldtime) {
   var nowtime = new Date();
   var milliseconds1 = oldtime.getTime();
   var milliseconds2 = nowtime.getTime();
   var difference = milliseconds2 - milliseconds1;

   if (difference > 1000*60*60*6) break;

   var daysDifference = Math.floor(difference/1000/60/60/24);
   difference = difference - daysDifference*1000*60*60*24
   var hoursDifference = Math.floor(difference/1000/60/60);
   difference = difference - hoursDifference*1000*60*60
   var minutesDifference = Math.floor(difference/1000/60);
   difference = difference - minutesDifference*1000*60
   var secondsDifference = Math.floor(difference/1000);
//   document.write('This topic is ' + daysDifference + ' days, ' + hoursDifference + ' hours, ' + minutesDifference + ' minutes, and ' + secondsDifference + ' seconds old.');

if (daysDifference > 1 && hoursDifference > 6)
   document.write('This topic is ' hoursDifference + ' hours, and ' + minutesDifference + ' minutes old.');
}
</script>


there ya go


Didn't like that, damn, this thing is hard to crack...
AndyP
 
Posts: 165
Joined: Wed Jan 10, 2007 10:10 pm

Postby InSAnE NiNjA » Sun May 29, 2005 12:42 am

Code: Select all
<script language="javascript>function difference(oldtime) {
   var nowtime = new Date();
   var milliseconds1 = oldtime.getTime();
   var milliseconds2 = nowtime.getTime();
   var difference = milliseconds2 - milliseconds1;
   var daysDifference = Math.floor(difference/1000/60/60/24);
   difference = difference - daysDifference*1000*60*60*24
   var hoursDifference = Math.floor(difference/1000/60/60);
   difference = difference - hoursDifference*1000*60*60
   var minutesDifference = Math.floor(difference/1000/60);
   difference = difference - minutesDifference*1000*60
   var secondsDifference = Math.floor(difference/1000);
//   document.write('This topic is ' + daysDifference + ' days, ' + hoursDifference + ' hours, ' + minutesDifference + ' minutes, and ' + secondsDifference + ' seconds old.');

if (daysDifference < 1 && hoursDifference < 6)
   document.write('This topic is ' hoursDifference + ' hours, and ' + minutesDifference + ' minutes old.');
}
</script>


i'm retarded.. i put greater than instead of less than
..nuttier then a squirrel turd..
User avatar
InSAnE NiNjA
 
Posts: 1213
Joined: Sat Jan 25, 2003 6:35 am

Postby AndyP » Sun May 29, 2005 5:35 pm

Still no luck, maybe somebody with an installation of coranto can test it to see if it's just me...
AndyP
 
Posts: 165
Joined: Wed Jan 10, 2007 10:10 pm

Previous

Return to Customization

Who is online

Users browsing this forum: No registered users and 2 guests

cron