PHP default timezone

there is a function in php to set the default time zone -

date_default_timezone_set('Asia/Calcutta'); 

but does it need to be called every time in the application when I want to use a date?

+1
timezone php
source share
2 answers

but does it need to be called every time in the application when I want to use a date?

If your application needs a different time zone than configured in php.ini , then yes, you must call date_default_timezone_set in your script. You will also need to call it if the time zone is not configured in php.ini, although if so, you need to pester your host to fix it.

+3
source share

You can set the time zone in php.ini and then not worry about calling it in the script every time: http://php.net/manual/en/datetime.configuration.php

+1
source share

All Articles