note 100926 deleted from function.date-diff by danbrown
| From: | danbrown@php.net | Date: | Tue, 16 Nov 2010 00:36:27 +0000 |
| Subject: | note 100926 deleted from function.date-diff by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174053@lists.php.net to get a copy of this message | ||
Note Submitter: Sergio Abreu
----
<?php
/*
Thanks Mr Sven, for the workaround for Date Interval.
Here goes a suggestion of code to expand format possibilities */
// The second block of code inside the format function:
$format = preg_replace('/%?y/i', $this->y, $format);
$format = preg_replace('/%?m/i', $this->m, $format);
$format = preg_replace('/%?d/i', $this->d, $format);
$format = preg_replace('/%?h/i', $this->h, $format);
$format = preg_replace('/%?i/i', $this->i, $format);
$format = preg_replace('/%?s/i', $this->s, $format);
// This allows format without % as 'd/m/Y H:i:s'
?>