I'm using MSSQL with PHP and this works fine on a Windows server.
When i move to a FreeBSD server, the date formatting is not working.
FreeBSD retrieves the date as: mon dd yyyy hh:mi:ss:mmmAM - and php's functions for formatting date fails.
I've tried using: Convert(varchar(10), Date, 103) AS Date, and the date is formatted fine - BUT sorting on date does NOT work.
Are there any way i can do changes to datetime behaviour on server side? I NEVER wants the date in mon dd yyyy hh:mi:ss:mmmAM. I don't need milliseconds, and i want 24h format - not AM/PM. Are there any settings on the SQL server for this?
Where are you doing your sorting? With T-SQL CONVERT-style affects sort:
ORDERBYConvert(nvarchar(30), OrderDate, 109)
|||I'm not sure what you mean. I SELECT Convert(varchar(10), Date, 103) AS Date, and last sentence is ORDER BY Date DESC.
Anyway - i would prefer to fix this server-side if possible, so that i don't need to rewrite all queries adding convert functions etc...
|||If you want to ORDER BY the output of Convert(varchar(10), Date, 103) then you have to put that expression in the ODER BY clause not simply the column named Date.|||I'll try that, but i don't think it will work, because it returns the date as a string, and thus sorting the strings from highest numbers, to lower, which does not not necessarily need to be correct(?)
Is this really the only reason to make it work?