Home Tutorial Php Phpdate DateInterval::format

 
 

Share on Google+Share on Google+
DateInterval::format
Posted on: August 26, 2009 at 12:00 AM
Advertisement
DateInterval::format function is used for formatting the interval. It returns the format interval.

DateInterval class in PHP

DateInterval::format function is used for formatting the interval. It returns the format interval. 

Description on PHP DateInterval Format

public string DateInterval::format ( string $format )

Parameters of DateInterval::format

format

The following characters are recognized in the format parameter string like 

Y - Years, numeric, at least 2 digits with leading 0 e.g. 02, 07

y - Years, numeric like 4, 8

M - Months, numeric, at least 2 digits with leading 0 for example 05, 09, 12

m - Months, numeric 02, 05, 11

D - Days, numeric, at least 2 digits with leading 0 e.g. 02, 04, 31

d - Days, numeric like 2, 10, 31

a - Total amount of days like 2, 14, 3650

H - Hours, numeric, at least 2 digits with leading 0 like 02, 12, 23

h - Hours, numeric 2, 6, 24

I - Minutes, numeric, at least 2 digits with leading 0 like 05, 33, 59

i - Minutes, numeric such as 2, 13, 59

S - Seconds, numeric, at least 2 digits with leading 0 like 02, 09, 57

s - Seconds, numeric such as 2, 9, 57

R - Sign "-" when negative, "+" when positive -, +

r - Sign "-" when negative, empty when positive -,

% Literal % %

Note: The prefix % is required in order for the format specifies to work correctly.
Learn How to Use DateInterval Format in PHP with example

Advertisement

Related Tags for DateInterval::format:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: August 26, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com