|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-02-01 20:13 UTC] requinix@php.net
-Type: Bug
+Type: Feature/Change Request
[2016-02-01 20:13 UTC] requinix@php.net
[2021-09-23 15:47 UTC] cmb@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: cmb
[2021-09-23 15:47 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 15 03:00:01 2025 UTC |
Description: ------------ Using date_parse_from_format() with a Unix Timestamp yields no error, but does not yields valid results as well. It sets the date to 1970-1-1, instead of the correct date. Test script: --------------- $ php -a Interactive mode enabled php > $unix = date('U'); php > echo $unix; 1454336317 php > echo date('Y-m-d H:i:s', $unix); 2016-02-01 12:18:37 php > print_r(date_parse_from_format('U', $unix)); Array ( [year] => 1970 [month] => 1 [day] => 1 [hour] => 0 [minute] => 0 [second] => 0 [fraction] => 0 [warning_count] => 0 [warnings] => Array ( ) [error_count] => 0 [errors] => Array ( ) [is_localtime] => 1 [zone_type] => 1 [zone] => 0 [is_dst] => [relative] => Array ( [year] => 0 [month] => 0 [day] => 0 [hour] => 0 [minute] => 0 [second] => 1454336317 ) ) Expected result: ---------------- It should fill in the array with "2016-02-01 12:18:37" info. Actual result: -------------- The array is filled with "1970-01-01", without error messages.