[DBAL-467] DateTime handling in sqlsrv 2005 not quite right Created: 20/Mar/13  Updated: 01/Apr/13  Resolved: 01/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Platforms
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Gordon Heydon Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None
Environment:

window, sql svr 2005



 Description   

The problem I am having is with how the DateTimeType converts the DateTime field from sql svr. It seems to need different formats in the ::getDateTimeFormatString() depending in if you are converting from the database to PHP or the other way.

The method format 'Y-m-d H:i:s.000' that is there now works if the database is only written to with PHP, and not anything else.

In my case I am sharing access with other technologies. So basically when converting from the Database to PHP the format needs to be 'Y-m-d H:i:s.u' and 'Y-m-d H:i:s.000' when converting the other way.

If there functions convertToDatabaseValue() and convertToPHPValue() where in the Platform, then I could override these with my own custom platform and I would be right.

Otherwise to do this right we need to split this up getDateTimeFormatString() into 2 different methods, 1 for the database, and 1 for php.



 Comments   
Comment by Benjamin Eberlei [ 01/Apr/13 ]

You can register your own type to handle this, or use the "VarDateTime" that is more flexible with this kind of date format.

Comment by Benjamin Eberlei [ 01/Apr/13 ]

I have clarified the VarDateTime approach in the SQL Server Platform Known Issues and Limitations documentation.

Generated at Fri Aug 29 12:12:58 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.