|
of_yearsafter
|
|
Full name
|
pfc_n_cst_datetime.of_yearsafter
|
Access
|
public
|
Extend of
|
long
|
Return value
|
long
|
Prototype
|
public function long of_yearsafter(date,date)
|
Name
|
Datatype
|
adb_end
|
double
|
adb_start
|
double
|
ld_temp
|
date
|
li_mult
|
int
|
li_year
|
int
|
ll_null
|
long
|
public function long of_yearsafter (date ad_start, date ad_end);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_YearsAfter
//
// Access: public
//
// Arguments:
// ad_start Starting date.
// ad_end Ending date.
//
// Returns: Long
// Number of years difference.
// If any argument's value is NULL, function returns NULL.
// If any argument's value is Invalid, function returns NULL.
//
// Description: Given two dates will determine the number of whole
// years between the two dates.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////////////
date ld_temp
int li_year, li_mult
double adb_start, adb_end
//Check paramemters
If IsNull(ad_start) or IsNull(ad_end) or &
Not of_IsValid(ad_start) or Not of_IsValid(ad_end) Then
long ll_null
SetNull (ll_null)
Return ll_null
End If
If ad_start > ad_end Then
ld_temp = ad_start
ad_start = ad_end
ad_end = ld_temp
li_mult = -1
else
li_mult = 1
End If
li_year = year(ad_end) - year(ad_start)
adb_start = month(ad_start)
adb_start = adb_start + day(ad_start) / 100
adb_end = month(ad_end)
adb_end = adb_end + day(ad_end) / 100
If adb_start > adb_end Then
li_year --
End If
Return li_year * li_mult
end function
Name
|
Owner
|
systemfunctions.day |
systemfunctions
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.month |
systemfunctions
|
systemfunctions.setnull |
systemfunctions
|
systemfunctions.year |
systemfunctions
|
pfc_n_cst_datetime.of_isvalid |
pfc_n_cst_datetime
|