Req #68268 [NEW]: DatePeriod: Getter for start date, end date and interval
| From: | dev at mabe dot berlin | Date: | Mon, 20 Oct 2014 08:23:10 +0000 |
| Subject: | Req #68268 [NEW]: DatePeriod: Getter for start date, end date and interval | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-188194@lists.php.net to get a copy of this message | ||
From: dev at mabe dot berlin
Operating system: Irrelevant
PHP version: Irrelevant
Package: Date/time related
Bug Type: Feature/Change Request
Bug description:DatePeriod: Getter for start date, end date and interval
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 bug report at https://bugs.php.net/bug.php?id=68268&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68268&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68268&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68268&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68268&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68268&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68268&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68268&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68268&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68268&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68268&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68268&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68268&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68268&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68268&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68268&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68268&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68268&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68268&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68268&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68268&r=mysqlcfg