Satyanshu Bhargav
Satyanshu Bhargav

Reputation: 23

How to set default time zone as UTC in php?

Best way to set default time zone in php.

Can i use .htaccess file to set the default time zone for a project or should i use php.ini file to set default time zone for my whole server?

Upvotes: 2

Views: 11044

Answers (2)

sangram singh
sangram singh

Reputation: 149

You have to write a single line in start of page

date_default_timezone_set('UTC');

Upvotes: 3

Richard87
Richard87

Reputation: 1621

It depends, I would reccomend using the same default timezone on the whole server + database etc... Keeps things simple in logs and while debugging time sensitive stuff :)

(In other words, use php.ini!)

Upvotes: 0

Related Questions