You could also use this:
ini_alter('date.timezone','Asia/Calcutta');
You should call this before calling any date function. It accepts the key as the first parameter to alter PHP settings during runtime and the second parameter is the value.
I had done these things before I figured out this:
date_default_timezone_set("Asia/Calcutta");
- did not workini_alter()
- IT WORKEDdate_default_timezone_set("Asia/Calcutta");
- IT WORKEDFor me the init_alter()
method got it all working.
I am running Apache 2 (pre-installed), PHP 5.3 on OSX mountain lion