Req #68268 [Opn->Csd]: DatePeriod: Getter for start date, end date and interval
| From: | stas@php.net | Date: | Mon, 01 Dec 2014 04:52:58 +0000 |
| Subject: | Req #68268 [Opn->Csd]: DatePeriod: Getter for start date, end date and interval | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188865@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68268&edit=1
ID: 68268
Updated by: stas@php.net
Reported by: dev at mabe dot berlin
Summary: DatePeriod: Getter for start date, end date and
interval
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: Date/time related
Operating System: Irrelevant
PHP Version: Irrelevant
-Assigned To:
+Assigned To: stas
Block user comment: N
Private report: N
New Comment:
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2014-10-20 08:23:09] dev at mabe dot berlin
Description:
------------
---
From manual page: http://www.php.net/class.dateperiod
---
Currently it's not possible to get the start date, the end date and the interval of an existing
DatePeriod instance.
Test script:
---------------
$start = new DateTime('2000-01-01 00:00:00', new DateTimeZone('Europe/Berlin'));
$end = new DateTime('2000-01-31 00:00:00', new DateTimeZone('UTC'));
$interval = new DateInterval('P1D');
$period = new DatePeriod($start, $interval, $end);
var_dump($period->getStartDate()->format('Y-m-d H:i:s'));
var_dump($period->getStartDate()->getTimeZone()->getName());
var_dump($period->getEndDate()->format('Y-m-d H:i:s'));
var_dump($period->getEndDate()->getTimeZone()->getName());
var_dump($period->getDateInterval()->format('%R%y-%m-%d-%h-%i-%s'));
Expected result:
----------------
string(19) "2000-01-01 00:00:00"
string(13) "Europe/Berlin"
string(19) "2000-01-31 00:00:00"
string(3) "UTC"
string(12) "+0-0-1-0-0-0"
Actual result:
--------------
Functions getStartDate, getEndDate and getDateInterval are missing
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68268&edit=1