Different server time with PHP

Asked

Viewed 320 times

0

I ask him to save in the comic book like this:

$datacadastro = date('Y-m-d H:i:s');

And he’s out an hour longer than he is on the server.

2019-04-17 13:06:59.000

How do I save it according to server time ?

  • And how did you check the server time? Have you checked the time zone settings?

  • Yes, the time zone is correct on the server machine, but the time shown in the BD is 1 A+.

  • But how did you check the server time? And the time zone I mentioned is in PHP.

  • True, in PHP it is an A+ on the machine. It would be possible to leave the O according to the machine?

  • Your question already has one answer here. Although you mentioned the [tag:mysql], it is a simple oversight not to have identified "where the time is wrong before asking the question".

1 answer

0

See if this example helps you, because it will vary from where you are, for this just search the Timezone you want.

date_default_timezone_set('America/Sao_Paulo');

Browser other questions tagged

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