downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

DateInterval::format> <DateInterval::__construct
[edit] Last updated: Fri, 24 Jun 2011

view this page in

DateInterval::createFromDateString

(PHP 5 >= 5.3.0)

DateInterval::createFromDateStringSets up a DateInterval from the relative parts of the string

Description

public static DateInterval DateInterval::createFromDateString ( string $time )

Uses the normal date parsers and sets up a DateInterval from the relative parts of the parsed string.

Parameters

time

Date with relative parts.

Return Values

Returns new DateInterval instance if success.



add a note add a note User Contributed Notes DateInterval::createFromDateString - [2 notes]
up
0
msleman at boot dot dot dot com
2 years ago
Sample usage:

<?php
$interval
= DateInterval::createFromDateString('1 month');
?>
up
0
Anonymous
3 years ago
DateInterval::createFromDateString ( string $time )

When the manual says "Uses the normal date parsers" it means that this function cannot take $time = ISO8601 strings like "P7D".  If you want to use those, you must use the constructor.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites