Req #69176 [Opn]: strtotime: support "first/last of" with weeks

From: Date: Thu, 28 May 2015 11:30:45 +0000
Subject: Req #69176 [Opn]: strtotime: support "first/last of" with weeks
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192962@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69176&edit=1

 ID:                 69176
 User updated by:    cpuidle at gmx dot de
 Reported by:        cpuidle at gmx dot de
 Summary:            strtotime: support "first/last of" with weeks
 Status:             Open
 Type:               Feature/Change Request
 Package:            Date/time related
 Operating System:   any
 PHP Version:        5.6.6
 Block user comment: N
 Private report:     N

 New Comment:

Nice suggestion. Thats actually how I finally solved it. You link gives strange results though for
5.2.0 - 5.2.17 versions and newer:

string(25) "2015-05-28T00:00:00+02:00" string(25) "2015-06-01T00:00:00+02:00"
string(25) "2015-05-28T00:00:00+02:00" string(25) "2015-05-25T00:00:00+02:00"

PHP 5.2 lives one week in the future or seems to have a different notion of week start.

But well, those are old anyway...


Previous Comments:
------------------------------------------------------------------------
[2015-05-28 09:56:44] arjen at react dot com

Use 'dayname [this|last] week midnight'.

See http://3v4l.org/MeDGO

------------------------------------------------------------------------
[2015-03-04 08:04:21] cpuidle at gmx dot de

> "first day of" is only documented to only work with months.

Not explicitly. In fact, docs say:

> This phrase is best used together with a month name following it.

It would actually be in line to make this work with year as well as week. Feel free to treat this as
an enhancement request.

------------------------------------------------------------------------
[2015-03-03 19:59:01] ab@php.net

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

"first day of" is only documented to only work with months.

Thanks.

------------------------------------------------------------------------
[2015-03-03 19:05:22] cpuidle at gmx dot de

Description:
------------
Both give the same results- Sunday 00:00

strtotime("first day of last week 00:00")
strtotime("first day of this week 00:00")

While Monday is a perfect workaround for "first day" it should work according to http://php.net/manual/de/datetime.formats.relative.php

Also, when exchanging week with month, it works like a charm.




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



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


Thread (7 messages)

« previous php.bugs (#192962) next »