Page 1 of 1

mssql dates returned incorrectly

Posted: Sun May 03, 2009 9:20 am
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