Fix Eror Timezone PHP


When I was learning PHP until how to showed time on browser, there was warning like writing bellow. The warning straight on appeared when I wanted to show time. Why like that? Really, it happened because the time zone setting on PHP different with my location.

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in C:\websites\belajar-php\hari.php on line 6
January 26, 13

Process of learn is really full of obstacle, if not about limited of time usually because of the material. Yeah, that’s why learn is interesting and how very happy when we can solve the problem, can’t we?

After day on alternate week I traid to solve the problem, I finally success. Version of PHP in my computer use time zone ‘UTC’, while I am in Indonesian. Then I wrote script bellow when I would show the time.

Script : 

date_default_timezone_set('Asia/jakarta');
$script_tz = date_default_timezone_get();

Like script bellow:




Before
After

Actually there are many way to solve it, now that is your job to find it. (Lough)
Good luck!

Learn diligently! While you still have time, before you too old and lose your chance for excavate your talent!

0 comments:

Post a Comment