PHP & mssql date/time fields
| From: | Alf Stockton | Date: | Fri, 17 Mar 2006 13:40:39 +0000 |
| Subject: | PHP & mssql date/time fields | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-26767@lists.php.net to get a copy of this message | ||
The next problem I need to resolve is accessing records in a PHP program from a mssql database where the index I need to select on is a datetime field and PHP appears to be ignoring the time portion.
The field is defined as
StartDate datetime 8
and would, when looking from Enterprise Manager, contain something similar to
2006/03/10 06:00:00 AM.
The select statement I use is similar to:-
select ID, Name, StartDate, EndDate FROM db WHERE ID=@ID AND @Today>=StartDate AND @Today <=EndDate ORDER BY EndDate
This, of course, means that two records where only the time is different are both selected whereas all I need is to get the one within the current date/time period.
Suggestions please.
--
Regards,
Alf Stockton www.stockton.co.za
Give your very best today. Heaven knows it's little enough.
My email disclaimer is available at www.stockton.co.za/disclaimer.html