| Newsgroups |
php.notes |
| Message-ID |
<[email protected]> |
If $datetime value is `null`, empty string, or whitespace(s), it will default to the current datetime or 'now'.
<?php
$date = null; // or '' or ' '
var_dump(date_create($date));
?>
returns
<?php
object(DateTime)#1 (3) {
["date"]=>
string(26) "2025-07-29 00:59:02.992777"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 2001:4450:4d02:6100:8164:9653:2bd8:2fef)
----
Manual Page -- https://php.net/manual/en/function.date-create.php
Edit -- https://main.php.net/note/edit/130432
Del: integrated -- https://main.php.net/note/delete/130432/integrated
Del: useless -- https://main.php.net/note/delete/130432/useless
Del: bad code -- https://main.php.net/note/delete/130432/bad+code
Del: spam -- https://main.php.net/note/delete/130432/spam
Del: non-english -- https://main.php.net/note/delete/130432/non-english
Del: in docs -- https://main.php.net/note/delete/130432/in+docs
Del: other reasons-- https://main.php.net/note/delete/130432
Reject -- https://main.php.net/note/reject/130432
Search -- https://main.php.net/manage/user-notes.php