Today I got a project written in PHP. There's an error when I try to show a date in a table data set. This is the statement that generates the error:
$data = new DateTime($registro["previsao de entrega"];
The error message is this:
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() Failed to parse time string (2 dez 2011 16:00) at position 0 (2): Unexpected character' in C:\www\fluxo_producao\Telas\TelaFluxoProducao.php:941 Stack trace: #0 C:\www\fluxo_producao\Telas\TelaFluxoProducao.php(941): DateTime->__construct('2 dez 2011 16:0...') #1 {main} thrown in C:\www\fluxo_producao\Telas\TelaFluxoProducao.php on line 941
What I discovered by myself was that if I change the parameter manually to "12 Dec 2006" for example, the function works. But the date the variable is passing is "12 Dez 2006" (Brazilian format, by the way, I'm Brazilian ^_^), and i found too that the default timezone in the server is "America/Sao_Paulo"... What do I have to change in the function or parameters to make it convert the format specified?
$registro["previsao de entrega"]