of_isleapyear


pfcapsrv.pbl   >   pfc_n_cst_datetime   >   of_isleapyear   

Full name pfc_n_cst_datetime.of_isleapyear
Access public
Extend of boolean
Return value boolean
Prototype public function boolean of_isleapyear(date)

Name Datatype
No Data

Name Datatype
lb_null boolean
li_year int

public function boolean of_isleapyear (date ad_source);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  		of_IsLeapYear
//
//	Access:  		public
//
//	Arguments:
//	ad_source		Date which contains the year to be tested.
//
//	Returns:  		boolean
//						TRUE if year is a leap year.
//						FALSE if year is not a leap year.
//						If any argument's value is NULL, function returns NULL.
//						If any argument's value is Invalid, function returns NULL.
//
//	Description:  	Based on the year in the passed date, determine if it is a 
//						leap year.
//
//////////////////////////////////////////////////////////////////////////////
//
//	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.
//
//////////////////////////////////////////////////////////////////////////////

int li_year
boolean lb_null
SetNull(lb_null)

//Check parameters
If IsNUll(ad_source) Then
	Return lb_null
End If

//Check for invalid date
If Not of_IsValid(ad_source) Then
	Return lb_null
End If

//Get the year using the string function instead of Year()
li_year = integer(string(ad_source,'yyyy'))

If ( (Mod(li_year,4) = 0 And Mod(li_year,100) <> 0) Or (Mod(li_year,400) = 0) ) Then
	Return True
End If

Return False


end function

     
Name Owner
pfc_n_cst_datetime.of_gregorian pfc_n_cst_datetime
pfc_n_cst_datetime.of_relativemonth pfc_n_cst_datetime
pfc_n_cst_datetime.of_relativeyear pfc_n_cst_datetime
pfc_n_cst_datetime.of_lastdayofmonth pfc_n_cst_datetime

     
Name Owner
systemfunctions.integer systemfunctions
systemfunctions.isnull systemfunctions
systemfunctions.mod systemfunctions
systemfunctions.setnull systemfunctions
systemfunctions.string systemfunctions
pfc_n_cst_datetime.of_isvalid pfc_n_cst_datetime

     
Full name
No Data

     
Name Scope
No Data