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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Tue Apr 16 19:01:31 2024 UTC