Tony
Tony

Reputation: 119

php Warning date() invalid date.timezone value,, we selected UTC timezone for now on server

Warning: date(): Invalid date.timezone value 'Asia/Singapore', we selected the timezone 'UTC' for now: in path/file.php on line 14.

i'm having above error when running on the server, while in my code i did not put any timezone.

well the things is, if im running on my local wamp server, there's no error display at all.

below is my code enter image description here

please advice. thanks.

Upvotes: 3

Views: 23856

Answers (3)

santho
santho

Reputation: 386

Try this:

date.timezone = "Asia/Singapore"

Edit:

Let's locate the correct php.ini. Fire this within apache / nginx / whatever web server deamon your using (because the command line version may be different by the one used by it).

<?php
 phpinfo();
?>

What's the .ini in the output? Still the same?

Edit2:

After the php.ini edit, just restart the webserver (apache or nginx.

Upvotes: 2

Imran Qamer
Imran Qamer

Reputation: 2263

Try to add following line before use of date function.

date_default_timezone_set('America/Los_Angeles');//change zone as per need

Upvotes: 1

Carson
Carson

Reputation: 152

if you want to ignore the warning, you can put this code at your first line

error_reporting(E_ALL ^ E_WARNING)

about timezone setting: not only PHP page can be set timezone but also php.ini can be set it.

Upvotes: 0

Related Questions