note 123232 added to function.date-parse-from-format
| From: | gilles dot migliori at gmail dot com | Date: | Mon, 15 Oct 2018 08:48:33 +0000 |
| Subject: | note 123232 added to function.date-parse-from-format | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209441@lists.php.net to get a copy of this message | ||
$date = "10 October 2018 19:30 pm";
print_r (date_parse_from_format("j F Y G:i a", $date));
Output:
Array (
[year] => 2018
[month] => 10
[day] => 10
[hour] => 31
[minute] => 30
[second] => 0
[fraction] =>
[warning_count] => 1
[warnings] => Array (
[24] => The parsed time was invalid
)
[error_count] => 0
[errors] => Array ( )
[is_localtime] =>
)
19:30 pm is invalid, 24-hour format of an hour can't be used with am/pm
must be replaced with:
$date = "10 October 2018 19:30";
print_r (date_parse_from_format("j F Y G:i", $date));
or:
$date = "10 October 2018 7:30 pm";
print_r (date_parse_from_format("j F Y g:i a", $date));
----
Server IP: 208.43.231.9
Probable Submitter: 2a01:e35:2ea6:8a40:5cfe:16a8:f7f6:d76
----
Manual Page -- http://php.net/manual/en/function.date-parse-from-format.php
Edit -- https://master.php.net/note/edit/123232
Del: integrated -- https://master.php.net/note/delete/123232/integrated
Del: useless -- https://master.php.net/note/delete/123232/useless
Del: bad code -- https://master.php.net/note/delete/123232/bad+code
Del: spam -- https://master.php.net/note/delete/123232/spam
Del: non-english -- https://master.php.net/note/delete/123232/non-english
Del: in docs -- https://master.php.net/note/delete/123232/in+docs
Del: other reasons-- https://master.php.net/note/delete/123232
Reject -- https://master.php.net/note/reject/123232
Search -- https://master.php.net/manage/user-notes.php