|
of_monthsafter
|
|
Full name
|
pfc_n_cst_datetime.of_monthsafter
|
Access
|
public
|
Extend of
|
long
|
Return value
|
long
|
Prototype
|
public function long of_monthsafter(date,date)
|
Name
|
Datatype
|
ld_temp
|
date
|
li_month
|
integer
|
li_mult
|
integer
|
ll_null
|
long
|
public function long of_monthsafter (date ad_start, date ad_end);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_MonthsAfter
//
// Access: public
//
// Arguments:
// ad_start Starting date.
// ad_end Ending date.
//
// Returns: Long
// Number of whole months between the two dates.
// If the end date is prior the start date, function returns
// a negative number of months.
// If any argument's value is NULL, function returns NULL.
// If any argument's value is Invalid, function returns NULL.
//
// Description: Given two dates, returns the number of whole months
// between the two.
//
//////////////////////////////////////////////////////////////////////////////
//
// 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
integer li_month
integer li_mult
//Check parameters
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_month = (year(ad_end) - year(ad_start) ) * 12
li_month = li_month + month(ad_end) - month(ad_start)
If day(ad_start) > day(ad_end) Then
li_month --
End If
Return li_month * 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
|