i want to make stackoverflow timestamps(X minutes ago, etc). How i can make it using zend_date? I found How to calculate time passed with PHP or Zend_Date? this realisation, but it uses other library. Are there any different ways?
Asked
Active
Viewed 1,510 times
3 Answers
2
How about Zend_Date::subDate()
?
$d1 = new Zend_Date();
$d2 = new Zend_Date($old_date);
$diff = $d1->subDate($d2);
After you've got the difference, you can check out one of these helpers:

chelmertz
- 20,399
- 5
- 40
- 46
1
Even if you don't want the whole Zym framework, you could still add their TimeSince
view helper to your own application.

cmbuckley
- 40,217
- 9
- 77
- 91
0
You can subtract timestamps of two dates to find difference between them in seconds and then use division and modulo to represent it as minutes, days etc.