From the course: PHP for Web Designers

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Adjusting the server's time zone

Adjusting the server's time zone - PHP Tutorial

From the course: PHP for Web Designers

Start my 1-month free trial

Adjusting the server's time zone

We've already met the PHP date function, which can be used to get different date and time paths. It's just one of an extensive range of date and time related functions. They all depend on the time set on your web server. And for them to work correctly, the PHP engine needs to know which time zone it's using. You can also change the time zone. There are two reasons you might want to do so. The first is if you have a situation like this page here. A whole series of ugly messages saying that it's not safe to rely on the system's time zone settings. The time zone needs to be set either in the PHP configuration, or by using a special function. And if we look at the time down here at the bottom, it says the local time is now 23:19 on Tuesday. Well I often do work late, but it's not actually as late as that. What has happened is that PHP has selected the time zone as being UTC, universal coordinated time, which is the same as GMT. Actually, although I come from London I'm currently in…

Contents