Server with intermittent time

Asked

Viewed 55 times

1

I have an external PHP server that has generated some time problems, sometimes it generates the correct time (eg: generates 17:00 to 17:00) and other times it generates with two more hours (ex: 19:00 to 17:00).

I have already tried to contact the server support, they say that there is no problem, but when recording data with change date I see many of the dates with this problem. I thought of using an external server with reliable time or some PHP function, to handle the error since definitely the server is not reliable...

  • 6

    already tried to set the location? date_default_timezone_set("America/Sao_Paulo");

1 answer

4


Probably your database is with a Timezone and the server with another.

In Mysql you can configure the time zone by running the following query on the terminal, in some program like Mysql Workbench, or even by code.

SET time_zone='America/Sao_Paulo';
-- ou
SET @@global.time_zone = '-3:00';

In PHP Add at the beginning of your code the following:

date_default_timezone_set("America/Sao_Paulo");

Browser other questions tagged

You are not signed in. Login or sign up in order to post.