|
of_relativeyear
|
|
Full name
|
pfc_n_cst_datetime.of_relativeyear
|
Access
|
public
|
Extend of
|
date
|
Return value
|
date
|
Prototype
|
public function date of_relativeyear(date,long)
|
Name
|
Datatype
|
ldt_null
|
date
|
li_day
|
integer
|
li_month
|
integer
|
li_year
|
integer
|
public function date of_relativeyear (date ad_source, long al_years);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_RelativeYear
//
// Access: public
//
// Arguments:
// ad_source Bbase date (starting point).
// al_years Number of years to increment or decrement the base date by.
//
// Returns: date
// The adjusted date
// If any argument's value is NULL, function returns NULL.
// If any argument's value is Invalid, function returns 1900-01-01.
//
// Description: Given a date, will return the date +/- the number of years passed
// in the second parameter.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
// 5.0.03 Fixed - function would fail under some international date sets
// 7.0 Fixed invalid date calculations
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
integer li_year, li_month, 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 of_IsValid(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)
If li_day > ii_daysinmonth[li_month] Then
If li_month = 2 and &
of_isleapyear(date(li_year, 01, 01)) Then
li_day = 29
Else
li_day = ii_daysinmonth[li_month]
end If
End IF
Return( Date(li_year, li_month, li_day))
end function
Name
|
Owner
|
systemfunctions.date |
systemfunctions
|
systemfunctions.day |
systemfunctions
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.month |
systemfunctions
|
systemfunctions.setnull |
systemfunctions
|
systemfunctions.year |
systemfunctions
|
pfc_n_cst_datetime.of_isleapyear |
pfc_n_cst_datetime
|
pfc_n_cst_datetime.of_isvalid |
pfc_n_cst_datetime
|