PHP date_interval_format() function
Mga Halimbawa
Tinuturing ang pagitan ng dalawang petsa, at pag-format ng takdang oras:
<?php $date1=date_create("1984-01-28"); $date2=date_create("1980-10-15"); $diff=date_diff($date1,$date2); // %a outputs the total number of days echo $diff->format("Total Days: %a."); ?>
Definition and Usage
The date_interval_format() function is an alias of DateInterval::format().
The DateInterval::format() function is used to format time intervals.
Syntax
DateInterval::format(format);
Parameter | Description |
---|---|
format |
Required. Specify the format. The format parameter string can use the following characters:
Note:Each format string must start with a '%' symbol! |
Technical Details
Return Value: | Return formatted time interval. |
---|---|
PHP Version: | 5.3+ |