PowerBuilder Function Relative Year gf_relative_year
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
///////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : gf_relative_year // Argument Name : ad_source, Arg Type : Date, Pass By : Value // al_years, Arg Type : Long, Pass By : Value // Return Type : Date /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Description: Given a date, will return the date +/- the number of years passed // in the second parameter. /////////////////////////////////////////////////////////////////////////////////////////////////////////////// Integer li_year Integer li_month Integer li_day //Check parameters If IsNull(ad_source) Or IsNull(al_years) Then Date ldt_null SetNull(ldt_null) Return ldt_null End If //Check for invalid date If Not f_Is_Valid_Date(ad_source) Then Return ad_source End If li_year = Year(ad_source) + al_years li_month = Month(ad_source) li_day = Day(ad_source) //Check for a valid day (i.e., February 30th is never a valid date) Do While Not f_Is_Valid_Date(Date(li_year, li_month, li_day)) And li_day > 0 li_day -- Loop Return( Date(li_year, li_month, li_day)) |
Good Luck!
Subscribe
Login
0 Comments
Oldest