Skip to content
Advertisement

PHP get UK local time from Server in different time zone

I have a web server which I do not know what the time zone is set to.

it is now 10:49am in the UK, but when I run the following:

JavaScript

The server returns the following time.

JavaScript

Now I don’t want to just “Add” one hour onto the time because the time still needs to be correct when time moves forward 1hr or back 1 hr.

Is there a way to get the ACTUAL time for LONDON?

FYI – I have also tried the following without any luck:

JavaScript

Many thanks in advance.

Advertisement

Answer

Don’t use gmdate(“d-m-Y H:i:s”) here because it returns GMT. Instead use date(“d-m-Y H:i:s”). Try this –

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement