How to calculate no of days between two dates?

eg: how i can calculate number of days between 1/12/2009 and 10/06/2010.(dd/mm/yyyy)

following queries gives difference in days.

select sysdate-to_date('03-jun-2010') from dual;

or

here date1,date2 are fields of date datatype.

select date2-date1 from sometable;

select trunc(to_date('01-SEP-2007')-to_date('22-JUN-2007')) as "days between dates" from dual;

kiran

select to_date('01-SEP-2007')-to_date('22-JUN-2007') as "days between dates" from dual;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.