How does the formatObject method in IntlDateFormatter differ from the format method in terms of parameters and functionality?

The formatObject method in IntlDateFormatter allows for more customization in formatting dates compared to the format method. It accepts an object parameter that can specify different formatting options such as calendar type, time zone, and locale. This method provides more flexibility in formatting dates according to specific requirements.

$date = new DateTime();
$formatter = new IntlDateFormatter('en_US', IntlDateFormatter::SHORT, IntlDateFormatter::SHORT);
$options = (object) ['calendar' => 'gregorian', 'timeZone' => 'UTC'];
echo $formatter->formatObject($date, $options);