i m using postgres . i have a table called opportunityhistory.

Create table opportunityhistory
opphis_id Numeric(10,0) NOT NULL,
opp_id Numeric(10,0) NULL ,
gmu_id Numeric(10,0) NULL ,
opp_changedfromstage_id Numeric(10,0) NULL ,
opp_changedtostage_id Numeric(10,0) NULL ,
opphis_date Timestamp with time zone NULL,
proscat_id Numeric(10,0) NULL ,
primary key (opphis_id)

i m trying to retireve the data from this table where opphis_date between 31st jan and 31st jan(that means i want to get the data on 31). but its not giving any data on 31(but data is there in table). but if we give opphis_date between 31st and 1st feb, query will retieve data on 31 jan.

my query is like this:
select * from opportunityhistory where opphis_date between TO_DATE('2005-01-31 00:00:01.914','YYYY-MM-DD HH24:MI:SS.#') and TO_DATE('2005-01-31 23:59:59.914','YYYY-MM-DD HH24:MI:SS.#')

can anyone say is there any way to select data on 31 jan by giving date between 31 and 31 ? ( i cant avoid between close as this same query is used to get data between 2 different dates.