mssql dates returned incorrectly

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
modplod
Forum Commoner
Posts: 45
Joined: Mon Feb 27, 2006 11:18 am

mssql dates returned incorrectly

Post by modplod »

Code: Select all

$query = "SELECT hlc_ticket, convert(varchar, getdate(), 21) hlc_until FROM table WHERE  (hlc_ticket LIKE '$prefix' ) AND (hlc_until >= '$date')";
Hi all, I'm having a problem with pulling dates from mssql DB with php, The above query pulls all the correct rows, but when I look at the data I noticed that all the dates and times are today (hlc_until is a smalldatetime field), no matter that in the db they all have dates other then today ($date is todays date). My question is... Is the convert command being used correctly or is the where clause messing with it some how? Any Ideas how to fix this?

Thanks
Post Reply