yyyy-mmm-dd to dd/mm/yyyy


orders.dateordered is datatime in the form yyyy-mm-dd
2010-01-01 18:04:14.000
2009-12-29 06:11:22.000
2010-01-02 05:55:21.000

$date1 is 31/01/2010  dd/mm/yyyy
select * from orders where dateordered is between $date1 and $date2


LVL 1
rgb192Asked:
Who is Participating?
 
LowfatspreadConnect With a Mentor Commented:
always supply your dates as YYYYMMDD and you wont have any problems,,,

e.g.

select * from orders
where dateordered between '20100405 00:00:00.000'
   and '20100506 23:59:59.999'


0
 
Aneesh RetnakaranDatabase AdministratorCommented:

select * from orders where dateordered  CONVERT(DATETIME, @Date1,103) AND CONVERT(DATETIME, @Date2,103)
0
 
rgb192Author Commented:
thanks
0
All Courses

From novice to tech pro — start learning today.