zero061099 Posted March 29, 2009 Share Posted March 29, 2009 Ok partially un related but to describe what im tryin to do...here it goes. I have a vbulletin forum. I got this mod that will show the latest X threads in a table at the top of my forum. This is ajax based and updates or auto refreshes everytime someone responds. Of course it shows the time and date of that last reply like this Last reply: 3-28, 8:22pm So I wanted to change it to say like this.... Last reply: 2 minutes ago. (without the date) Of course I set the time frame for this for 60 minutes. SO after the 60 minutes it will look like this.... Last reply: 3-28, 61 minutes ago SO a buddy helped me change it with this code //number of minutes between now and last post $time_difference = (time() - $gthread[lastpost]) / 60; if( $time_difference < 60 ) { $gnptime = $time_difference .' minutes ago'; } else { $gnptime = vbdate('j-n, g:i', $gthread[lastpost]); } from this last reply: 3-28, 8:23pm TO last reply: 2.5454841 minutes ago My question is how to get rid of the .5454841 ago and just have it say last reply: 2 minutes ago? Thanks for any help! BTW: I asked him about that but thats all he knows. Link to comment https://forums.phpfreaks.com/topic/151564-time-format/ Share on other sites More sharing options...
Salkcin Posted March 29, 2009 Share Posted March 29, 2009 ex, <?php $time = '2.5454841'; list($min) = explode('.', $time); echo $min; // 2 ?> Link to comment https://forums.phpfreaks.com/topic/151564-time-format/#findComment-796037 Share on other sites More sharing options...
zero061099 Posted March 29, 2009 Author Share Posted March 29, 2009 NVM solved did this.... $time_difference = round((time() - $gthread[lastpost]) / 60); INSTEAD of this $time_difference = (time() - $gthread[lastpost]) / 60; thanks for replying Link to comment https://forums.phpfreaks.com/topic/151564-time-format/#findComment-796038 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.