Home » RDBMS Server » Server Administration » Help : Date calculation
Help : Date calculation [message #370593] |
Tue, 04 January 2000 04:35  |
Siby Thomas
Messages: 2 Registered: December 1999
|
Junior Member |
|
|
How to write a function, to calculate maturity date from the following.
The parameters are - opening date , current date, number of periods (number), unit (like year, month,Quarter,day).
Does anyone know if such a script already exists? Or does anybody have any tips about the use of existing date functions.
Thanks
|
|
|
Re: Help : Date calculation [message #370601 is a reply to message #370593] |
Wed, 05 January 2000 06:16   |
Paul
Messages: 164 Registered: April 1999
|
Senior Member |
|
|
Siby,
Don't know of existing function, but it seems to be some fairly easy calculations -
to add/subtract days:
new_date := your_date + n;
new_date := your_date - n;
where n is the number of days to add/subtract
to add/subtract months:
new_date := add_months(your_date,n);
new_date := add_months(your_date,-n);
where n is the number of months to add/subtract
to add/subtract years, use add_months with (n * 12)
quarters depend on your definition,
either use add_months with (n * 3), if your definition of a quarter is 90 days,
or days with (n * 90), if you define a quarter as three months
If you use a 'house' definition of a year (I've seen both 360 and 364 day 'years') you can handle them like quarters ((n * 360) for example).
Hope this helps,
Paul
|
|
|
|
|
Goto Forum:
Current Time: Fri May 02 21:05:28 CDT 2025
|