user1594938
user1594938

Reputation:

How to change timezone in php?

Hello I have hostgator web hosting and since their server are in America and I live in Europe my timezone in php is USA.How can I change timezone because I insert date and time in mysql.

Upvotes: 2

Views: 442

Answers (4)

crissieboy
crissieboy

Reputation: 53

ini_set('date.timezone', 'America/Los_Angeles');

http://www.electrictoolbox.com/php-change-timezone/

other way to change timezone.

Upvotes: 0

Fry_95
Fry_95

Reputation: 241

If you're using a DateTime Object, use date_timezone_set http://php.net/manual/en/datetime.settimezone.php

Upvotes: 0

Please use

date_default_timezone_set

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

Following link will help you to find your timezone European

http://php.net/manual/en/timezones.europe.php

Upvotes: 0

Baba
Baba

Reputation: 95161

You can use date_default_timezone_set in php

Example

 date_default_timezone_set('Europe/Vienna');

Upvotes: 5

Related Questions