Remove use of deprecated constants.

Fixes #2232
Make use of timezone parameter in CakeTime::dayAsSql()
Merge pull request #2236 from bcrowe/hotfix-timezoneParam

Make use of timezone parameter in CakeTime::dayAsSql()
Add missing trim() around Sqlserver queries.

This solves issues with queries failing.

Fixes #2222
Fix COUNT(DISTINCT x) queries from getting corrupted in Sqlserver.

Add into the tower of hacks that is the SQL generation and stop breaking
COUNT(DISTINCT foo) style queries. Previously these would be converted
into DISTINCT COUNT(foo) which will give the non-distinct results.
Update date comparisons to be strict in CakeTime
Merge pull request #2239 from bcrowe/hotfix-strictTimeCompare

Update date comparisons to be strict in CakeTime
Merge branch 'master' into 2.5