TeddyKiller Posted April 7, 2010 Share Posted April 7, 2010 This will include timestamp in which is in the database, and current time. I want to be able to display a timestamp, not in a date format. eg: y,m,d etc. But in a .. "x days ago" method. If the timestamp in the database is.. within 24 hours from current time, it'll display "posted X hours ago" If the timestamp is within 1 hour, it'll display "Posted X minutes ago" Else if the timestamp is bigger than 24 hours, it'll display "Posted x days ago" How can this be done? Quote Link to comment https://forums.phpfreaks.com/topic/197931-posted-2-days-ago-how-would-i-do-something-similar/ Share on other sites More sharing options...
premiso Posted April 7, 2010 Share Posted April 7, 2010 http://snippets.dzone.com/posts/show/3044 A "Time Since" function is what you are after. Quote Link to comment https://forums.phpfreaks.com/topic/197931-posted-2-days-ago-how-would-i-do-something-similar/#findComment-1038631 Share on other sites More sharing options...
TeddyKiller Posted April 7, 2010 Author Share Posted April 7, 2010 Perfect! Thanks premiso. Quote Link to comment https://forums.phpfreaks.com/topic/197931-posted-2-days-ago-how-would-i-do-something-similar/#findComment-1038640 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.