Bug #70694 [Opn->Nab]: When using the date function, I have a problem

From: Date: Mon, 12 Oct 2015 09:21:21 +0000
Subject: Bug #70694 [Opn->Nab]: When using the date function, I have a problem
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196545@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70694&edit=1 ID: 70694 Updated by: derick@php.net Reported by: bear dot gan at qq dot com Summary: When using the date function, I have a problem -Status: Open +Status: Not a bug Type: Bug Package: Calendar related Operating System: ubuntu 14 ,windows PHP Version: 5.4Git-2015-10-12 (Git) Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You are on windows, which only supports 32 bit integers. The timestamp for "2099-3-31" would fall outside of the 32-bit range, which runs out somewhere in 2038. What you want to do is: $dt = new DateTime("2099-3-31 0:0:0"); echo $dt->format("Y-m-d H:i:s"); Previous Comments: ------------------------------------------------------------------------ [2015-10-12 08:59:17] bear dot gan at qq dot com Description: ------------ When using the date function, I have a problem, set up a date 2099/3/31, the results in the conversion of PHP $t = '2099-3-31 0:0:0'; $time = strtotime($t); echo $time.': '.date('Y-m-d H:i:s', $time).'<br>'; The result of echo is 00:00:00 1970-01-01 Test script: --------------- $t = '2099-3-31 0:0:0'; $time = strtotime($t); echo $time.': '.date('Y-m-d H:i:s', $time).'<br>'; Expected result: ---------------- [echo]The result of echo is 1970-01-01 00:00:00 Actual result: -------------- 2099-3-31 0:0:0 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70694&edit=1

« previous php.bugs (#196545) next »