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

search for in the

DatePeriod> <DateInterval::createFromDateString
Last updated: Fri, 30 Oct 2009

view this page in

DateInterval::format

(PHP 5 >= 5.3.0)

DateInterval::formatFormats the interval

Beschreibung

public string DateInterval::format ( string $format )

Formats the interval.

Parameter-Liste

format

The following characters are recognized in the format parameter string.
format character Description Example values
Y Years, numeric, at least 2 digits with leading 0 01, 03
y Years, numeric 1, 3
M Months, numeric, at least 2 digits with leading 0 01, 03, 12
m Months, numeric 01, 03, 12
D Days, numeric, at least 2 digits with leading 0 01, 03, 31
d Days, numeric 1, 3, 31
a Total amount of days 4, 18, 8123
H Hours, numeric, at least 2 digits with leading 0 01, 03, 23
h Hours, numeric 1, 3, 23
I Minutes, numeric, at least 2 digits with leading 0 01, 03, 59
i Minutes, numeric 1, 3, 59
S Seconds, numeric, at least 2 digits with leading 0 01, 03, 57
s Seconds, numeric 1, 3, 57
R Sign "-" when negative, "+" when positive -, +
r Sign "-" when negative, empty when positive -,
% Literal % %

Hinweis: The prefix % is required in order for the format specifiers to work correctly.

Rückgabewerte

Returns the formatted interval.



add a note add a note User Contributed Notes
DateInterval::format
Olav Schettler
13-Oct-2009 02:14
Please note that, as opposed to http://www.php.net/manual/en/datetime.format.php which accepts plain format characters in date() format, this function requires a "%" prefix.

DatePeriod> <DateInterval::createFromDateString
Last updated: Fri, 30 Oct 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites