Php sql timestamp for Iphone app

Go To StackoverFlow.com

-2

how can i do it just like Twitter and Facebook does.

  • If post was made within 1 hour - show how many minutes ago. (ie: 5 minutes ago, 39 minutes ago, etc.)
  • If post was made more than 1 hour ago, but less than 24 hours ago, show how many hours (ie: 2 hours ago, 7 hours ago, 22 hours ago)
  • If post was made more than 24 hours ago, show how many days ago post was made (3 days ago, 8 days ago, 18 days ago, etc.)

how can i do it using php and sql ?

2012-04-05 17:57
by Ahsan Muhammad


0

The easiest solution would be to use DateTime:diff()

http://www.php.net/manual/en/datetime.diff.php

Compare time(), which is current, to the database date.

2012-04-05 18:26
by wesside
Ads