Create Timezone function for PHP and Mysql UTC

Asked

Viewed 53 times

0

I am migrating to a Cloud hosting where Mysql is with Timezone UTC, I could not execute the commands to switch to GMT -3 and support does not give me another option.

Today my requests are saved in the Database with the date/time of the database itself, so I thought to make a function or some adjustment in PHP itself, but still unsuccessful.

Last attempt

<?php date_default_timezone_set('America/Sao_Paulo'); ?>

  • Tried to execute SET @@session.time_zone = "+00:00"; in mysql soon after connecting to the database?

  • I tried and also was not, I had to change the hosting to one on BR, but thanks for the suggestion!

  • Actually my suggestion was confusing, I would need to switch to -3 in the code of my previous comment

  • Yes, I did with -03:00 but also it was not, I even tried to import the bank with this function.

No answers

Browser other questions tagged

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