|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-09-12 08:51 UTC] glavic at gmail dot com
Description: ------------ The ISO-8601 states the following: "The offset from UTC is given in the format ±[hh]:[mm], ±[hh][mm], or ±[hh].". But DatePeriod accepts only $iso formats that are in UTC (flag Z). See test script. I have tried all possible combinations to set timezone correctly, but no success: http://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators Test script: --------------- <?php $iso = 'R2/2013-09-09T12:00:15Z/P1D'; $periods = new DatePeriod($iso); var_dump( is_object($periods) ); $iso = 'R2/2013-09-09T12:00:15+02:00/P1D'; $periods = new DatePeriod($iso); var_dump( is_object($periods) ); Run this on multiple PHP versions: http://3v4l.org/b4n9j Expected result: ---------------- bool(true) bool(true) # with correct offset ofc Actual result: -------------- bool(true) Fatal error: Uncaught exception 'Exception' with message 'DatePeriod::__construct(): Unknown or bad format (R2/2013-09-09T12:00:15+02:00/P1D)' in ... PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 11:00:02 2025 UTC |
I'm working on it. meanwhile you can use: `$periods = new DatePeriod(new DateTime("2013-09-09T12:00:15+02:00"), new DateInterval("P1D"), 2);`