php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #65695 mktime() with year 2016
Submitted: 2013-09-18 10:33 UTC Modified: 2013-09-18 10:52 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: philippe dot alcaina at hotmail dot fr Assigned:
Status: Duplicate Package: *Calendar problems
PHP Version: 5.5.3 OS:
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: philippe dot alcaina at hotmail dot fr
New email:
PHP Version: OS:

 

 [2013-09-18 10:33 UTC] philippe dot alcaina at hotmail dot fr
Description:
------------
I'm a french developer computer.
For an internet tool I need to get a list of weeks after having selected one year and one month.
By testing I found a BUG in the year 2016.
PHP gives me:
1 January 2016 the number of week: 53 (instead of 1)
January 31, 2016 the number of week: 4 (instead of 5)
then the error shifts in other months.
The system works correctly in 2013, 2014, 2015.

I provide you sample of the code that allows me to build this list of weeks, I particularly use mktime ()

// timestamp of first day of month
$time = mktime(0,0,0,$mois_select,1,$annee_select);
// number of days of month
$nbrJoursMois = intval(date('t',$time));
// the number of the first week
$numSemaineDebutMois = intval(date('W', $time));
// timestamp of end month
$timeFinMois = mktime(0,0,0,$mois_select,$nbrJoursMois,$annee_select);
// the number of the last week
$numSemaineFinMois = intval(date('W', $timeFinMois));

/**** Display results ****/
$annee_select = 2016
$mois_select = 1
$time = 1451602800
$nbrJoursMois = 31
$numSemaineDebutMois = 53  (Error)
$timeFinMois = 1454194800
$numSemaineFinMoisnum = 4   (Error)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-09-18 10:52 UTC] nikic@php.net
-Status: Open +Status: Duplicate
 [2013-09-18 10:52 UTC] nikic@php.net
Duplicate of http://php.net/65694.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 23:01:29 2024 UTC