The current Postgresql provides calculation to find date difference in months by getting (year difference * 12 )+ Months difference. This calculation gives integer number of months.
but if we want to have months difference in decimal, we will have to add days difference also in calculation, which becomes super lengthy way to calculate just Months difference of 2 dates.
addition to it, if we are deriving date_from and Date_to by some addition calculation, we have to repeat the same in all three stages.
Is there any simple way/simple function like DATE_DIFF in sql to calculate date difference. if not available, i would suggest to consider making one for next release. this will make developers life easier.
Unfortunately, there is not an easy way to do date calculations with PostgreSQL Here is a webpage which lays out different ways of doing date calculations. At the end of that page there is a UDF that you can build on and use directly inside of your database. Since this is a database related request, I suggest that you put in a request with the PostgreSQL community to add that function.
Hope that helps...
I am not able to find where should i put this request. also i tried to compile the function given there but it is not working, i mean it is not even creating that function itself. i will try one more time but meanwhile would be good if i get link where i can post this request.
For PostgreSQL, you can start here under support or community. You will probably need to establish a sign on with them before they let you open a feature request.
Powered by IDERA