php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24324 PEAR :: Date :: getWeeksInMonth () -- Ocassionally Wrong
Submitted: 2003-06-24 21:03 UTC Modified: 2003-06-25 14:20 UTC
From: cricket at djcricket dot com Assigned:
Status: Not a bug Package: PEAR related
PHP Version: 4.3.2 OS: FreeBSD 4.8-STABLE
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cricket at djcricket dot com
New email:
PHP Version: OS:

 

 [2003-06-24 21:03 UTC] cricket at djcricket dot com
Description:
------------
When Using the getWeeksInMonth() method of the PEAR::Date class, ocassionally the calculation is wrong. The following code shows that July/2003 returns 6 weeks in the month, instead of 5.

This error was duplicated with the same code on a RedHat 7.3 box as well.

Reproduce code:
---------------
require_once 'Date.php';
$date = new Date ( mktime ( 0 , 0 , 0 , 6 , 1 , 2003 ) );
echo "Date: " . $date->getDate () . "<br>\nWeeks In Month: " . $date->getWeeksInMonth ();

Expected result:
----------------
Date: 2003-06-01 00:00:00
Weeks In Month: 5 

Actual result:
--------------
Date: 2003-06-01 00:00:00
Weeks In Month: 6 

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-25 14:20 UTC] cricket at djcricket dot com
This is the expected behavior. I did not realize that Monday was used by the class as the beginning of a week. Sorry about the bogus bug =-/
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 07 23:01:27 2024 UTC