Bug #75524 [Opn]: last monday this week working wrong
| From: | padre dot cedano at gmail dot com | Date: | Tue, 14 Nov 2017 16:45:23 +0000 |
| Subject: | Bug #75524 [Opn]: last monday this week working wrong | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-212581@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75524&edit=1
ID: 75524
User updated by: padre dot cedano at gmail dot com
Reported by: padre dot cedano at gmail dot com
Summary: last monday this week working wrong
Status: Open
Type: Bug
-Package: PDO Core
+Package: Date/time related
PHP Version: 7.0.25
Block user comment: N
Private report: N
New Comment:
Previuos package error
Previous Comments:
------------------------------------------------------------------------
[2017-11-14 16:44:07] padre dot cedano at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/datetime.modify
---
If i try this today, 2o17-11-14:
modify('last monday this week')
the result is:
06/11/2017
But last monday this week was:
13/11/2017
Test script:
---------------
<?php
function getLastDayofWeek ($strDia){
$date=new DateTime('now');
$strCriterio='last '.$strDia.' this week';
$date->modify($strCriterio);
echo $strCriterio.": ".$date->format('d/m/Y').PHP_EOL;
}
/*Pruebas*/
getLastDayofWeek('monday');
getLastDayofWeek('saturday');
getLastDayofWeek('sunday');
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75524&edit=1