timespan() returns whole format like "45 Years, 5 Months, 6 Days, 8 Hours, 39 Minutes" but I want to get only days and months only so how can I set the format for timespan() in CodeIgniter
Asked
Active
Viewed 745 times
0
-
possible duplicate of [Format timespan in PHP/CodeIgniter](http://stackoverflow.com/questions/18151002/format-timespan-in-php-codeigniter) – Don't Panic May 28 '15 at 19:17
1 Answers
0
You can not change the format of timespan()
without modifying the function. It only takes two parameters -
The first parameter must contain a Unix timestamp. The second parameter must contain a timestamp that is greater that the first timestamp. If the second parameter empty, the current time will be used. The most common purpose for this function is to show how much time has elapsed from some point in time in the past to now.
So, if you want this to work your way you have to modify the function (which is not suggested as it is a library helper function) or you can define one own your own.

Sougata Bose
- 31,517
- 8
- 49
- 87