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.
- Object oriented style
bool IntlCalendar::setTimeZone( mixed $timeZone )
- Procedural style
bool intlcal_set_time_zone( IntlCalendar $cal, mixed $timeZone )
Parameters: This function uses two parameters as mentioned above and described below:
- $cal: This parameter holds the resource of IntlCalendar.
- $timeZone: This parameter holds the new timezone which is used by this calendar.
- NULL: The default timezone will be used.
- IntlTimeZone: It is used directly.
- DateTimeZone: The identifier of DateTimeZone object will be extracted and an ICU timezone object will be created.
- string: It should be a valid ICU timezone identifier.
Return Value: This function returns TRUE on success and FALSE on failure.
Below program illustrates the IntlCalendar::setTimeZone() function in PHP:
Thursday, March 21, 2019 at 9:19:29 AM India Standard Time Thursday, March 21, 2019 at 11:49:29 AM Singapore Standard Time Thursday, March 21, 2019 at 9:19:29 AM GMT+05:30 Thursday, March 21, 2019 at 3:49:29 AM GMT