php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38279 mktime dont work right on all 31 day of a month
Submitted: 2006-08-01 07:09 UTC Modified: 2006-08-01 13:47 UTC
From: support at ml-networld dot de Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.1.4 OS: Debian Sarge
Private report: No CVE-ID: None
 [2006-08-01 07:09 UTC] support at ml-networld dot de
Description:
------------
On the 31 Juli, Oktober, Dezember the code below say that the lastmonth is the current month. But on the 31 August it say that the last month is jul. this code is an example code from nuntius on the site http://de2.php.net/manual/de/function.mktime.php

Reproduce code:
---------------
$dateMinusOneMonth = mktime(0, 0, 0, date("m")-1, date("d"),  date("Y"));
$lastmonth = date("M", $dateMinusOneMonth);
echo $lastmonth;

Expected result:
----------------
on the 31 juli
jun

on the 31 oktober
sep

on the 31 dezember
nov

Actual result:
--------------
on the 31 juli
jul

on the 31 oktober
okt

on the 31 dezember
dez

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-01 07:11 UTC] support at ml-networld dot de
sorry,
i put the wrong phpversion
 [2006-08-01 07:32 UTC] tony2001@php.net
You need to set correct timezone.
 [2006-08-01 07:37 UTC] support at ml-networld dot de
i have the right timezome
Europe/Berlin
 [2006-08-01 09:07 UTC] support at ml-networld dot de
I test this problem in a xammp environment under my local windows, and there i have the same problem.
 [2006-08-01 13:01 UTC] mgf@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Clue: what are the 31sts of June, September and November?
 [2006-08-01 13:45 UTC] support at ml-networld dot de
thx.
 [2006-08-01 13:47 UTC] derick@php.net
.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 11:01:36 2025 UTC