Jump to content

relative timestamps


doddsey_65

Recommended Posts

ok so i am using relative timestamps on my forum. if a post was created less than 1 hour ago then it will display something like 32 minutes ago. If it was posted more than 1 hour ago it will display "posted today at 10:00pm", or if it was older than 1 day then it will display the absolute time stamp. My question is how do i get them to update automatically like facebook does? i would like to use jquery for this but after searching i cant make heads or tales of any of it.

 

so to sumarise i would like the timestamps to update without having to refresh the page.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/222811-relative-timestamps/
Share on other sites

Well if you know javascript the concept of ajax shouldn't be too far off for you. Gathering information from another URL on the server without leaving the page, luckily we have libraries like jQuery that have built in ajax commands, like jquery.load(). Look into those two concepts, however I'm not sure how efficient loading the time from another page would be, perhaps there's a simpler javascript way someone can let us in on.

Link to comment
https://forums.phpfreaks.com/topic/222811-relative-timestamps/#findComment-1152094
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.