PDO & MSSQL Datetime problem

I have a stored procedure in MS SQL which does return a datetime.

If I fire the sp in MS SQL Query Analyzer this gets returned.
2006-06-01 14:15:00

If I fire the sp using PDO in PHP. The following gets returned:
Jun 1 2006 2:15PM

Does anyone have an idea of what’s happening? Do I need to set some attribute?

I’m having exactly the same problem. Does anyone know the fix?


Thats just fine.

Dates in MsSql are actually stored as binary fields packed in a special manner so as to be readable as dates. The query analyizer and such show the default decoding of the date (your first note).

I suspect the second is PHP default date decoding.

I have not used PHP in a bit, so I am hesitant to recommend exactly how to handle the date, you might want to go ask in that forum. But there is no database or user error here.

unless microsoft has changed this in sql server 2005, no – dates are actually stored as integers (which are not very readable as dates)