Generally speaking, date queries do not involve time queries, but some time fields in the database table will contain time content, which will lead to inaccurate query results. There are generally two solutions:
1. Add the time when querying, the start time is "00:00:00", the end time is "23:59:59", the relevant code
date_time>= to_date('2016-04-04 00:00:00', 'yyyy-MM-dd hh24:mi:ss')
date_time <= to_date('2016-07-22 23:59:59', 'yyyy-MM-dd hh24:mi:ss')
date_time <= to_date('2016-07-22 23:59:59', 'yyyy-MM-dd hh24:mi:ss')
2. Convert time type to character type, related code
to_char(date_time,'yyyy-mm-dd') >= '2016-04-04'
to_char(date_time,'yyyy-mm-dd') <= '2016-07-22'
to_char(date_time,'yyyy-mm-dd') <= '2016-07-22'
A way of writing characters without '-'
to_char(date_time,'yyyymmdd') >= to_char(to_date('2016-04-04','yyyy-mm-dd'),'yyyymmdd')
to_char(date_time,'yyyymmdd') <= to_char(to_date('2016-07-22','yyyy-mm-dd'),'yyyymmdd')
to_char(date_time,'yyyymmdd') <= to_char(to_date('2016-07-22','yyyy-mm-dd'),'yyyymmdd')