PHP date function is an in-built function that simplify working with date data types. The PHP date function is used to format a date or time into a human readable format. It can be used to display the date of article was published. record the last updated a data in a database.
PHP set Timezone Programmatically
The date_default_timezone_set function allows you to set the default time zone from a PHP script.
The script below displays the time according to the default time zone set in php.ini.
It then changes the default time zone to Asia/Calcutta and displays the time again.
Before we look at how to set the default time zone programmatically, let’s look at how to get a list of supported time zones.