In facebook or twitter time of post is changing every minute on every post.
Any idea how to make it?
Make a field in your database for each post, that records the time & date when it was posted.
Then you can make a function that returns the current datetime - the insertdatetime...
You round it off to whatever you want(ours, mins, seconds), and you just have to call that function than.
You mean send AJAX request every minute to php function that gets date and counts the difference?
yeah...But it's not a very efficient solution though...To make that much database calls is not really good for the performance of your website.
Take a look at this link:
If you enhance this script a bit, you'll get the result you want, with much better performance.