Oracle Date-Time range query
Field: String type (char), Length: 10
1=1'2011-06-01'2011-07-05';
Between To_date (' 2011-06-01 ', ' yyyy-mm-dd ') and to_date (' 20110705 ', ' yyyymmdd ');
Field: String type (char), Length: 20
SELECT * from Testdatetime t WHERE1=1and T.usedate >='2011-06-01'and T.usedate <='2011-07-05'; SELECT* FROM Testdatetime t WHERE1=1and To_date (T.usedate,'YYYY-MM-DD HH24:MI:SS') between To_date ('2011-07-01 12:00:00','YYYY-MM-DD HH24:MI:SS') and To_date ('20110702 12:00:00','YYYYMMDD HH24:MI:SS') ;
Field: DateTime type (DATE)
SELECT * from Testdatetime t WHERE1=1and T.startdate >= to_date ('2011-07-01','YYYY-MM-DD') and T.startdate<= To_date ('2011-07-02','YYYY-MM-DD'); SELECT* FROM Testdatetime t WHERE1=1and t.startdate between To_date ('2011-07-01','YYYY-MM-DD') and To_date ('2011-07-02','YYYY-MM-DD');
SELECT * from Testdatetime t WHERE 1=1 and t.startdate = To_date (' 2011-07-01 12:00:00 ', ' yyyy-mm-dd HH24:MI:SS ');
SELECT * from Testdatetime t WHERE 1=1 and To_char (t.startdate, ' yyyy-mm-dd ') = ' 2011-07-01 ';
SELECT * from Testdatetime t WHERE 1=1 and To_char (t.startdate, ' yyyy-mm-dd ') >= ' 2011-07-01 ' and To_char (t.startdate, ' Y Yyy-mm-dd ') <= ' 2011-07-02 ';
Oracle Date Time range query