PHP IntlCalendar setTime() Function Last Updated : 03 Apr, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report PHP IntlCalendar::setTime() function is an inbuilt function in PHP which is used to set the calendar time object in terms of milliseconds since the epoch. The calendar time instant is represented by the float and its value should be an integer number of milliseconds since the epoch (1 Jan 1970 00:00:00.000 UTC). It ignores the leap second. Syntax: Object-oriented stylebool IntlCalendar::setTime( float $date )Procedural stylebool intlcal_set_time( IntlCalendar $cal, float $date ) Parameters: This function uses two parameters as mentioned above and described below: $cal: This parameter holds the resource of IntlCalendar.$date: This parameter holds the instant represented by the number of milliseconds between the instant and the epoch time. It is ignoring leap seconds. Return Value: This function returns TRUE on success and FALSE on failure. Below example illustrates the IntlCalendar::setTime() function in PHP: Example: php <?php // Set the date timezone ini_set('date.timezone', 'Asia/Calcutta'); // Create a DateTime object $cal = IntlCalendar::fromDateTime('2019-03-21 09:19:29'); // Format the DateTime object echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n"; // Declare a new IntlGregorianCalendar object $cal = new IntlGregorianCalendar(2019, 8, 22, 10, 30, 34); // Format the DateTime object echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n"; // Set the DateTime object $cal->setTime(strtotime('2019-10-27 -05:30:00 GMT') * 1000); // Format the DateTime object echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL); ?> Output:Thursday, March 21, 2019 at 9:19:29 AM India Standard Time Sunday, September 22, 2019 at 10:30:34 AM India Standard Time Thursday, January 1, 1970 at 5:30:00 AM India Standard Time Reference: https://www.php.net/manual/en/intlcalendar.settime.php Comment More infoAdvertise with us Next Article PHP IntlCalendar setTime() Function J jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Intl Similar Reads PHP | IntlCalendar set() Function The IntlCalendar::set() function is an inbuilt function in PHP which is used to set the time field or several common fields at once. The range of field value depends on the calendar. This function can not be called with exactly four parameters. Syntax: Object oriented style bool IntlCalendar::set( i 2 min read PHP | IntlCalendar setTimeZone() Function The IntlCalendar::setTimeZone() function is an inbuilt function in PHP which is used to set the new timezone for this calendar. The time is represented in terms of object and it preserves to the detriment of the timezone field values. Syntax: Object oriented style bool IntlCalendar::setTimeZone( mix 2 min read PHP | IntlCalendar toDateTime() Function The IntlCalendar::toDateTime() function is an inbuilt function in PHP which is used to convert an IntlCalendar object into a DateTime object. The DateTime object represents upto second precision with error round less than 1 second. Syntax: Object oriented styleDateTime IntlCalendar::toDateTime( void 1 min read PHP | IntlCalendar roll() Function The IntlCalendar::roll() function is an inbuilt function in PHP which is used to add value to field without carrying into more significant fields. The difference between IntlCalendar::roll() and IntlCalendar::add() function is that, the field value of IntlCalendar::roll() function overflow, it does 2 min read PHP | IntlCalendar setFirstDayOfWeek() Function The IntlCalendar::setFirstDayOfWeek() function is an inbuilt function in PHP which is used to set the day on which the week is to be started. This function affects the behaviors of fields that depend on the week such as IntlCalendar::FIELD_WEEK_OF_YEAR and IntlCalendar::FIELD_YEAR_WOY. Syntax: Objec 1 min read Like