php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50697 BUG mktime function
Submitted: 2010-01-08 20:43 UTC Modified: 2010-01-08 21:14 UTC
From: cybermandanger at gmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.12 OS: Linux Red Hat Enterprise 5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cybermandanger at gmail dot com
New email:
PHP Version: OS:

 

 [2010-01-08 20:43 UTC] cybermandanger at gmail dot com
Description:
------------
Bug in mktime function parameters.

mktime function expects 7 numeric parameters. I?ve passed instead of 8 (whick is numeric) the value 08 (which is also numeric) but the shown result is completly unexpected. 

Example: 
<?php
$intData = mktime(00,00,00,01,08,2010);
echo date("d/m/Y H:i:s", $intData);
?>
should print 08/01/2010 00:00:00 but is printing 31/12/2009 00:00:00.

Note: the problem occurs only with day parameter. if I send 08 in the month parametes the result is right.

Reproduce code:
---------------
$intData = mktime(00,00,00,01,08,2010);
echo date("d/m/Y H:i:s", $intData);

Expected result:
----------------
08/01/2010 00:00:00

Actual result:
--------------
31/12/2009 00:00:00

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-08 21:14 UTC] derick@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

08 is interpreted as an (invalid) octal number. Octal numbers start with 0 and can only have the digits 0-7 in them.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 15 04:01:30 2024 UTC