php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #37187 gmmktime() documentation error
Submitted: 2006-04-24 18:35 UTC Modified: 2006-04-26 11:21 UTC
From: reywob@php.net Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2006-04-24 18:35 UTC] reywob@php.net
Description:
------------
The manual entry above is wrong.  The statement:
"Identical to mktime() except the passed parameters represents a GMT date."
should read
"Identical to mktime() except the timestamp produced represents a GMT date."

Here is a test case:
<?
// Assume month/day/year are set to today
$x = gmmktime(gmdate('H'),gmdate('i'),gmdate('s'),$month,$day,$year);
print ($x >= gmmktime()) ? "Yes" : "No";
?>
This produces "Yes" as the answer.  Changing it to:
<?
// Assume month/day/year are set to today
$x = gmmktime(date('H'),date('i'),date('s'),$month,$day,$year);
print ($x >= gmmktime()) ? "Yes" : "No";
?>
Produces the expected answer of "No"

Reproduce code:
---------------
<?
// Assume month/day/year are set to today
$x = gmmktime(gmdate('H'),gmdate('i'),gmdate('s'),$month,$day,$year);
print ($x >= gmmktime()) ? "Yes" : "No";
?>

Expected result:
----------------
No

Actual result:
--------------
Yes

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-26 11:21 UTC] vrana@php.net
Timestamp is always the number of seconds since 1970-01-01 00:00:00 GMT independent on function. You didn't specify your timezone, but in +01:00 mktime(1, 0, 0, 1, 1, 1970) correctly returns 0 and mktime(1, 0, 0, 1, 1, 1970) returns 3600.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC