1
I made a select in SQLSERVER inside php:
mssql_query(SELECT TOP 1 ven.DATA FROM tab_venda ven (nolock)
INNER JOIN dbo.tab_item_venda iven (nolock)
ON iven.num_Venda = ven.NUM_VENDA
INNER JOIN dbo.tab_produto pro (nolock)
ON pro.cod_produto = iven.cod_produto
WHERE ven.tipo_venda <> 'X'
AND pro.Situacao = 1
AND (pro.ind_controle_periodo = 1 OR pro.Marca = 'RQ ETIQUETAS')
AND ven.COD_PESSOA = @cod_cliente
AND pro.cod_produto = @cod_produto
ORDER BY ven.DATA DESC)
This SELECT is returning me the date in the following format: Feb 19 2013 12:00:00:000 within PHP. If case I made the same direct select in SQLSERVER Management Studio it returns me in the format: 2013-02-19 00:00:00
The first question would be: Because within PHP the date format is being: Feb 19 2013 12:00:000?
When I try to format the date using:
date('Y-m-d', strtotime($data))
the result being: 1969-12-31
The second question is, why is it returning to date 1969-12-31 instead of 2013-02-19?
I don’t think that answers either of the two questions.
– Jéf Bueno
It is an alternative to dealing with the return of her SELECT, maybe it will be useful and solve both questions and maybe it is not, but it is an answer, collaborate with one of yours as well. Hug @Jéfersonbueno
– Mastria
Yes, that is an alternative I know. But if you pay attention you will see that the questions are:
Porque dentro do PHP o formato da data esta sendo: Feb 19 2013 12:00:00:000?
andPorque esta retornando a data 1969-12-31 em vez de 2013-02-19?
– Jéf Bueno
Thank you very much for the help, even trying to format directly in SELECT the return continues in the format: Feb 19 2013 12:00:00:000 I believe it is something linked to the date format on Linux, I guess right.. in a know
– Laísa Ferreira Cardoso
I edited the answer with the PHP formatting option if you help @Laísaferreiracardoso
– Mastria