Carlos if I understood your question is this answer that will meet your need, first of all it would be ideal if you read the documentation and understand the operation of timezone
and datetime
of php
.
In your system you should receive the variable and arrow-there with the desired timezone, in your case São Paulo.
new DateTimeZone('America/Sao_Paulo');
Receive the variable by parameter and set it with this timezone
$date = new DateTime('2017-10-14 10:04:59 GMT'); //entre os ( ) irá sua variável
$date->setTimezone($tz);
ready your room has been set with the desired timezone
, and at that time you can use it to save in the bank, but it is important to read the documentation because at this time you implement it in different ways, I made two form just to exemplify your case, but in the documentation you will understand the various ways to do it.
echo $date->format('Y-m-d g:i:s A');
Result: 2017-10-14 7:04:59 AM
echo $date->format('l F j Y g:i:s A');
Result: Saturday October 14 2017 7:04:59 AM
The complete code looks like this:
$tz = new DateTimeZone('America/Sao_Paulo');
$date = new DateTime('2017-10-14 10:04:59 GMT'); // aqui dentro dos parenteses você deve coloca a sua váriavel DateTime($variavel);
$date->setTimezone($tz); //seta o timezone da váriavel
echo $date->format('Y-m-d g:i:s A'); //imprime o horário no padrão do timezone
echo '<br>';
echo $date->format('l F j Y g:i:s A');
And you can test on this LINK