Edit report at https://bugs.php.net/bug.php?id=65694&edit=1

 ID:                 65694
 Updated by:         der...@php.net
 Reported by:        philippe dot alcaina at hotmail dot fr
 Summary:            error calendar in year 2016, with function mktime()
-Status:             Open
+Status:             Not a bug
 Type:               Feature/Change Request
 Package:            Date/time related
 Operating System:   windows linux
 PHP Version:        5.5.3
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This seems to work just fine. PHP uses the ISO8601 calendar which indeed has a 
week "2015-53" for the period Mon Dec 28, 2015 to Sun Jan 3, 2016. Please see 
http://en.wikipedia.org/wiki/ISO_week_date for more information.


Previous Comments:
------------------------------------------------------------------------
[2013-09-18 10:22:52] 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.




Test script:
---------------
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)







------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65694&edit=1

Reply via email to