Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL - Time Query

Status
Not open for further replies.

simran1

Programmer
Apr 23, 2002
82
US
Hi,

I have this Query
SQl = "Select * from IncidentReport Where ITime = '8:58:00 AM'"

And i have a record to match the comparison. But i still get the record count to be Zero.
How do i do time comparisons?
 
Try ...

Select * from IncidentReport Where
Convert(Char(12), ITime,108) = '8:58:00 AM' Thanks

J. Kusch
 
Hi,
Am sorry, but i still get my record count to be zero.
 
Do you have to query using the AM/PM time format? Can you use the 24 hour format?

Using 108 with CONVERT returns the time as hh:mm:ss (24 hour format).

If you can use that format, try this:

Select * from IncidentReport Where
Convert(Char(12), ITime,108) = '08:58:00'

-SQLBill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top