Log in

View Full Version : select between date and time



tirso
02-27-2009, 07:12 AM
hi to all

I have field date and time respectively. I want to select date between (date1 and time1 > 17) and (date2 < 17)

I tried these but unsuccessful.

any suggestions would greatly appreciated

tnx

tirso


SELECT * from purchases_suppliers WHERE (date_invoice >= '2009/02/25' and time_invoice > 17) AND (date_invoice <= '2009/02/27' AND time_invoice < 17)

or


SELECT * from purchases_suppliers WHERE date_invoice between ('2009/02/25' ANd time_invoice > 17) AND ('2009/02/27' AND time_invoice < 17 )

JasonDFR
03-02-2009, 05:53 PM
What are the types of your date and time columns? What does a date in the database look like?

For example, a datetime column looks like 2009-03-02 10:59:23 .