false
@1690388256
2008-W28-3
<? php
$res = date_parse ( "2015-09-31" );
var_dump ( $res [ "warnings" ]);
?>
array(1) { [11] => string(27) "The parsed date was invalid" }
<? php
$res = DateTimeImmutable :: createFromFormat ( "Y-m-d" , "2015-09-34" );
var_dump ( $res );
object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-10-04 17:24:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/London" }
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note :
For the
y and
yy formats, years below 100 are handled in a special way when the
y or
yy symbol is used. If the year falls in the range 0 (inclusive) to 69 (inclusive), 2000 is added. If the year falls in the range 70 (inclusive) to 99 (inclusive) then 1900 is added. This means that "00-01-01" is interpreted as "2000-01-01".
Note :
The "Day, month and two digit year, with dots or tabs" format (
dd [.\t]
mm "."
yy ) only works for the year values 61 (inclusive) to 99 (inclusive) - outside those years the time format "
HH [.:]
MM [.:]
SS " has precedence.
Note :
The "Year (and just the year)" format only works if a time string has already been found -- otherwise this format is recognised as
HH
MM .
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note :
The "W" in the "ISO year with ISO week" and "ISO year with ISO week and day" formats is case-sensitive, you can only use the upper case "W".
The "T" in the SOAP, XMLRPC and WDDX formats is case-sensitive, you can only use the upper case "T".
The "Unix Timestamp" format sets the timezone to UTC.
|
|
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note :
Relative statements are always processed after non-relative statements. This makes "+1 week july 2008" and "july 2008 +1 week" equivalent.
Exceptions to this rule are: "yesterday", "midnight", "today", "noon" and "tomorrow". Note that "tomorrow 11:00" and "11:00 tomorrow" are different. Considering today's date of "July 23rd, 2008" the first one produces "2008-07-24 11:00" where as the second one produces "2008-07-24 00:00". The reason for this is that those five statements directly influence the current time.
Keywords such as "first day of" depend on the context in which the relative format string is used. If used with a static method or function, the referent is the current system timestamp. However, if used in DateTime::modify() or DateTimeImmutable::modify() , the referent is the object on which the
modify() method is called.
Note :
Observe the following remarks when the current day-of-week is the same as the day-of-week used in the date/time string. The current day-of-week could have been (re-)calculated by non-relative parts of the date/time string however.
"
dayname " does not advance to another day. (Example: "Wed July 23rd, 2008" means "2008-07-23"). "
number
dayname " does not advance to another day. (Example: "1 wednesday july 23rd, 2008" means "2008-07-23"). "
number week
dayname " will first add the number of weeks, but does not advance to another day. In this case "
number week" and "
dayname " are two distinct blocks. (Example: "+1 week wednesday july 23rd, 2008" means "2008-07-30"). "
ordinal
dayname " does advance to another day. (Example "first wednesday july 23rd, 2008" means "2008-07-30"). "
number week
ordinal
dayname " will first add the number of weeks, and then advances to another day. In this case "
number week" and "
ordinal
dayname " are two distinct blocks. (Example: "+1 week first wednesday july 23rd, 2008" means "2008-08-06"). "
ordinal
dayname 'of' " does not advance to another day. (Example: "first wednesday of july 23rd, 2008" means "2008-07-02" because the specific phrase with 'of' resets the day-of-month to '1' and the '23rd' is ignored here).
Also observe that the "of" in "
ordinal
space
dayname
space 'of' " and "'last'
space
dayname
space 'of' " does something special.
It sets the day-of-month to 1. "
ordinal
dayname 'of' " does not advance to another day. (Example: "first tuesday of july 2008" means "2008-07-01"). "
ordinal
dayname " does advance to another day. (Example: "first tuesday july 2008" means "2008-07-08", see also point 4 in the list above). "'last'
dayname 'of' " takes the last
dayname of the current month. (Example: "last wed of july 2008" means "2008-07-30") "'last'
dayname " takes the last
dayname from the current day. (Example: "last wed july 2008" means "2008-06-25"; "july 2008" first sets the current date to "2008-07-01" and then "last wed" moves to the previous Wednesday which is "2008-06-25").
Note :
Relative month values are calculated based on the length of months that they pass through. An example would be "+2 month 2011-11-30", which would produce "2012-01-30". This is due to November being 30 days in length, and December being 31 days in length, producing a total of 61 days.
Note :
number is an integer number; if a decimal number is given, the dot (or comma) is likely interpreted as delimiter. For instance,
'+1.5 hours' is parsed like
'+1 5 hours' , not as
'+1 hour +30 minutes' .
|
|
---|---|
|
|
|
|