php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #15216 Number of weeks or parts thereof in a month
Submitted: 2002-01-24 23:41 UTC Modified: 2017-01-11 06:37 UTC
Votes:10
Avg. Score:4.1 ± 1.3
Reproduced:7 of 8 (87.5%)
Same Version:5 (71.4%)
Same OS:5 (71.4%)
From: ceo at l-i-e dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: * OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ceo at l-i-e dot com
New email:
PHP Version: OS:

 

 [2002-01-24 23:41 UTC] ceo at l-i-e dot com
It would be Really Nifty (tm) if the date function had a 
letter that meant:

number of weeks or partial weeks in a month

Then, a monthly-calendar system would know how many rows 
you'll need...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-29 17:42 UTC] jani@php.net
-Package: Feature/Change Request +Package: Date/time related -Operating System: All +Operating System: * -PHP Version: 4.1.1 +PHP Version: *
 [2017-01-11 06:37 UTC] heiglandreas@php.net
-Status: Open +Status: Not a bug
 [2017-01-11 06:37 UTC] heiglandreas@php.net
It almost has. With a bit of date-match you can calculate that like this:

$date = new DateTime('2017-02-01'); 
echo ceil(($date->format('t') + 6 - $date->format('w')) /7);

As it's something that can be done easily in userland there's no need to add further complexity to the sources,
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC