F_IS_VALID_DATE

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Function Name : f_is_valid_date
// Argument Name : ad_source, Arg Type : Date, Pass By : Value
// Return Type :      Boolean
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Description:      Given a date, will determine if the Date is valid.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

Integer     li_year
Integer    li_month
Integer    li_day

// Initialize test values.
li_year = Year(ad_source)
li_month = Month(ad_source)
li_day = Day(ad_source)

// Check for nulls.
If  IsNull(ad_source) Or IsNull(li_year) or IsNull(li_month) or IsNull(li_day) Then
    Return False
End If

// Check for invalid values.
If  li_year <= 0 or li_month <= 0 or li_day <= 0 Then
    Return False
End If

// Passed all testing.
Return True

0 comments:

Post a Comment