datediff equivalent in Oracle
431158Jul 4 2005 — edited Jul 4 2005Hi,
In SQL Server, there is a function datediff with datepart 'q'/quarter which behaves as follows :--
select datediff(q,'03-30-2005','04-01-2005') will return 1
datediff(q,start date,end date)
i.e it takes the quarter in which the start date exists and subtracts it from the quarter in which the end date exists.
I need the equivalent for the above in Oracle.
I found the below in OMWB document :--
Equivalent as : round(months_between(date2, date1)/3)
But this will not work for particular data, since the logic in which SQL Server executes the DATEDIFF is different as I have explained above. Please can anyone give the exact equivalent if any available.
Thanks,
Sam