note 120703 deleted from function.strtotime by crell
| From: | crell@php.net | Date: | Thu, 30 Jun 2022 20:10:54 +0000 |
| Subject: | note 120703 deleted from function.strtotime by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218806@lists.php.net to get a copy of this message | ||
Note Submitter: alex at newpathconsulting dot com
----
Be careful when sending a NULL string to strtotime() - it evaluates NULL to 0 and thus returns the
UNIX timestamp at 0 (December 31, 1969).
Can evaluate the string first like so ($dateString contains string):
$dateString ? date('d-m-Y', strtotime($dateString ))