RE: [PHP-DB] Trouble retrieving DATETIME info from MSSQL - resolved
| From: | Matthew DeChant | Date: | Tue, 02 Oct 2001 20:50:58 +0000 |
| Subject: | RE: [PHP-DB] Trouble retrieving DATETIME info from MSSQL - resolved | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-12938@lists.php.net to get a copy of this message | ||
Dates in MSSQL are stored as:
mon dd yyyy hh:miAM (or PM)
and ODBC converts them to:
yyyy-mm-dd hh:mi:ss.mmm(24h)
so:
select * from Internetlog where convert(varchar, LogTime, 121) like
'%2001-10-02%'
-----Original Message-----
From: Matthew DeChant [mailto:mdechant@insightpd.com]
Sent: Monday, October 01, 2001 2:26 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Trouble retrieving DATETIME info from MSSQL
Hello,
I am having trouble getting data from a DATETIME field in MSSQL 7.0.
The data in a general select query look like this:
2001-09-25 14:23:17.000
I can do this in MSSQL:
select * from INTERNETLOG where Datetime like %2001%
but not this:
select * from INTERNETLOG where Datetime like %2001/09/25%
or
select * from INTERNETLOG where Datetime like %20010925%
or
select * from INTERNETLOG where Datetime like %2001/09%
or
select * from INTERNETLOG where Datetime like %14:23%