I saw the similar questions, but none with answer, my date is coming like this from the bank 2017-05-05T00: 00: 00 + 00: 00 when I try to make a date ('dm-Y', strtotime ($ date)); she comes so 04-05-2017, how can she make it come 05-05-2017? Why does this occur? Why does she come back one day?
echo date('d-m-Y',strtotime($publicacao['dataPublicacao']));
Here it takes the bank through the token and publication id and returns a json
function getSinglePublicacao($id){
session_start();
include_once "token.php";
$token = getToken($_SESSION['username'],$_SESSION['password']);
ob_start();
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, 'http://politizar.azurewebsites.net/api/cadastro/publicacao/getSingle/'.$id );
curl_setopt( $ch, CURLOPT_HEADER, 0 );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $token ) );
curl_exec( $ch );
$data = ob_get_contents();
ob_end_clean();
$httpCode = curl_getinfo( $ch, CURLINFO_HTTP_CODE );
curl_close( $ch );
return json_decode($data, true);
}
And here were my attempts, obs the return of publication ['dataPublicacao']; returns 2017-05-05T00: 00: 00 + 00: 00
e o resto retorna a data faltando um dia
$partidos = listarPartido($token_access);
$idPublicacao = $_GET['idPublicacao'];
$publicacao = getSinglePublicacao($idPublicacao);
print_r($publicacao);
$cidades = listarCidades($token_access);
echo str_replace("-","/",date('d-m-Y',strtotime($publicacao['dataPublicacao'])));
echo str_replace("-","/",date('d-m-Y',$publicacao['dataPublicacao']));
echo "<br>";
echo date('d-m-Y',strtotime($publicacao['dataPublicacao']));
echo "<br>";
echo $publicacao['dataPublicacao'];