The IntlCalendar::fieldDifference() function is an inbuilt function in PHP which is used to return the difference between given time and the object time.
- Object oriented style:
int IntlCalendar::fieldDifference( float $when, int $field )
- Procedural style:
int intlcal_field_difference( IntlCalendar $cal, float $when, int $field )
- $cal: This parameter holds the IntlCalendar resource name.
- $when: This parameter holds the time against which to compare the quantity represented by the field.
- $field: This parameter holds the field that represents the quantity being compared.
Return Value: This function returns a signed difference of time in the unit associated with the specified field on success or FALSE on failure.
Below program illustrates the IntlCalendar::fieldDifference() function in PHP:
First Time: Dec 21, 2018, 9:30:25 AM Last Time: Aug 29, 2019, 11:20:20 AM Time difference: 0-Years 8-Months 8-Days 1-Hours 49-Minutes