PHP Pretty Date10 February 2008
- Requires PHP >= 5.10, due to the usage of PHP’s new DateTimeclass.
// pass in a String DateTime, compared to another String DateTime (defaults to now) $myString = Date_Difference::getStringResolved('-7 weeks'); $myString = Date_Difference::getStringResolved('-7 weeks', '+1 week'); // pass in a DateTime object, compared to another DateTime object (defaults to now) // useful with the Propel ORM, which uses DateTime objects internally. $myString = Date_Difference::getString(new DateTime('-7 weeks')); $myString = Date_Difference::getString(new DateTime('-7 weeks'), new DateTime('+1 week'));
Download PHP Pretty Date (PHP 5.10 , 1.86KB)