php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #36401 Bug in mktime()
Submitted: 2006-02-15 13:31 UTC Modified: 2006-02-18 23:55 UTC
From: marcel dot alburg at alkronet dot info Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.1.2 OS: Linux
Private report: No CVE-ID: None
 [2006-02-15 13:31 UTC] marcel dot alburg at alkronet dot info
Description:
------------
If i enter

print mktime(0,0,0,0,0,0) 

i get "943916400" but it must be "0"


print date('r', mktime(0,0,0,0,0,0));

returns

Tue, 30 Nov 1999 00:00:00 +0100

Marcel Alburg

Reproduce code:
---------------
print mktime(0,0,0,0,0,0);

returns 943916400


Expected result:
----------------
mktime(0,0,0,0,0,0) must be 0


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-15 13:35 UTC] derick@php.net
Why? The result is correct. You're getting the timestamp for 0 january-1 (december of the previous year), year 0 (which is 2000) at 00:00:00. This is exactly 30 november 1999, 00:00:00
 [2006-02-15 13:42 UTC] marcel dot alburg at alkronet dot info
but in previosly versions it get 0 back.

because that i mean it's an error

thanks

marcel alburg
 [2006-02-15 15:16 UTC] mgf@php.net
Ah, but, the documentation says:

"If the arguments are invalid (eg. if the year, month and day are all 0), the function returns FALSE (before PHP 5.1 it returned -1)."

Furthermore, I've just tested on an ancient PHP 4.0 I had lying around, and mktime(0,0,0,0,0,0) does indeed return -1.

So it seems there's something to be resolved here, whether it be fixing mktime or changing the documentation.
 [2006-02-15 15:32 UTC] derick@php.net
6 0's here is not invalid, so marking as a doc problem.
 [2006-02-18 23:55 UTC] nlopess@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:11 UTC] phpdocbot@php.net
Automatic comment on behalf of nlopess
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=1c00847e5791da63997816702a0f4180aecce7a6
Log: fix #36401: year, month and day can be passed as 0
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 09 22:01:33 2025 UTC