I have a table TEST with a DATETIME field, like this:
DATETIME
ID NAME DATE 1 TESTING 2014-03-19 20:05:20.000
select * from invoice where TRANS_DATE_D>= to_date ('20170831115959','YYYYMMDDHH24MISS') and TRANS_DATE_D<= to_date ('20171031115959','YYYYMMDDHH24MISS');