note 124659 added to class.datetime
| From: | david dot p dot mclaughlin at gmail dot com | Date: | Tue, 28 Jan 2020 22:47:15 +0000 |
| Subject: | note 124659 added to class.datetime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-213972@lists.php.net to get a copy of this message | ||
Example displaying each time format:
$dateTime = new DateTime();
foreach ([
'ATOM',
'COOKIE',
'ISO8601',
'RFC822',
'RFC850',
'RFC1036',
'RFC1123',
'RFC2822',
'RFC3339',
'RFC3339_EXTENDED',
'RSS',
'W3C',
] as $format) {
eval("print
'DateTimeInterface::$format\t'.\$dateTime->format(DateTimeInterface::$format).\"\n\";");
}
The above example will output:
DateTimeInterface::ATOM 2020-01-28T16:22:37-07:00
DateTimeInterface::COOKIE Tuesday, 28-Jan-2020 16:22:37 MST
DateTimeInterface::ISO8601 2020-01-28T16:22:37-0700
DateTimeInterface::RFC822 Tue, 28 Jan 20 16:22:37 -0700
DateTimeInterface::RFC850 Tuesday, 28-Jan-20 16:22:37 MST
DateTimeInterface::RFC1036 Tue, 28 Jan 20 16:22:37 -0700
DateTimeInterface::RFC1123 Tue, 28 Jan 2020 16:22:37 -0700
DateTimeInterface::RFC2822 Tue, 28 Jan 2020 16:22:37 -0700
DateTimeInterface::RFC3339 2020-01-28T16:22:37-07:00
DateTimeInterface::RFC3339_EXTENDED 2020-01-28T16:22:37.803-07:00
DateTimeInterface::RSS Tue, 28 Jan 2020 16:22:37 -0700
DateTimeInterface::W3C 2020-01-28T16:22:37-07:00
----
Server IP: 45.112.84.4
Probable Submitter: 38.142.137.34 (proxied: 76.8.216.2)
----
Manual Page -- http://php.net/manual/en/class.datetime.php
Edit -- https://master.php.net/note/edit/124659
Del: integrated -- https://master.php.net/note/delete/124659/integrated
Del: useless -- https://master.php.net/note/delete/124659/useless
Del: bad code -- https://master.php.net/note/delete/124659/bad+code
Del: spam -- https://master.php.net/note/delete/124659/spam
Del: non-english -- https://master.php.net/note/delete/124659/non-english
Del: in docs -- https://master.php.net/note/delete/124659/in+docs
Del: other reasons-- https://master.php.net/note/delete/124659
Reject -- https://master.php.net/note/reject/124659
Search -- https://master.php.net/manage/user-notes.php