marxizmmarxizm
marxizmmarxizm

Reputation: 31

How to change default time zone in php

i received a website built in php and mysql, but the coder left the default time zone in UTC format, how do i change that to EDT so all of the controls within the site now use EDT time NOT UTC. I've looked throughout the code and the coder calls strttotime in some places but i dont see timezone anywhere, the times that show up everywhere come from database columns containing UNIX timestamp with strttotime.

Upvotes: 0

Views: 350

Answers (1)

ceejayoz
ceejayoz

Reputation: 179994

For PHP:

date_default_timezone_set('America/New_York');

http://php.net/manual/en/function.date-default-timezone-set.php

This is also configurable in your server's php.ini file.

For MySQL, in my.cnf:

default_time_zone='America/New_York'

or for a single session, a query of:

SET time_zone = 'America/New_York';

Upvotes: 1

Related Questions