Setting Local Time Zone on cPanel Hosting For PHP date() Function


Please pardon me if it’s the the appropriate forum for this topic. I’m cPanel shared hosting and not able to find an option to set my local timezone/time offset. So, whenever I try to track time on my site using PHP date() function, I used to get server date/time (PST) instead of my local time (IST). It’s highly inconvenient for me and my website users, since tracing the correct local time for users’ activity is really important for me.

Please suggest a solution for this. Can this setting/configurations be changed anyhow on standard cPanel hosting? If not, how can I do it using PHP. I have a config file which is used (included at the begining) in all the PHP files of my site. So, I can put a piece of code snippet in that config file to make a site-wide change. Please guide me.

Have a look at [fphp]date_timezone_set[/fphp] :slight_smile:

Thanks for the info.
If I use this function to set the correct timezone, will it work script-wide? I mean, if I call this function (to set my local timezone) at the beginning of the php file, will all the date() function calls return the local time?

Yes :slight_smile: