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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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: Fri May 17 12:01:32 2024 UTC