;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfIsWeekDay (strYmdHms) intJulianDow = (5 + TimeJulianDay (strYmdHms)) mod 7 If 6 == intJulianDow Then Return @FALSE If 0 == intJulianDow Then Return @FALSE Return @TRUE ; This user defined function "udfIsWeekDay" determines wether a given date is a weekday or not. ; The function returns a boolean value of @FALSE (0) or @TRUE (1). ; Weekdays are the days in the range Monday..Friday. #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ ;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfIsWeekendDay (strYmdHms) intJulianDow = (5 + TimeJulianDay (strYmdHms)) mod 7 If 6 == intJulianDow Then Return @TRUE If 0 == intJulianDow Then Return @TRUE Return @FALSE ; This user defined function "udfIsWeekendDay" determines wether a given date is a weekendday or not. ; The function returns a boolean value of @FALSE (0) or @TRUE (1). ; Weekenddays are the days in the range Saturday..Sunday. #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ ; Test. strDT1 = "2002:07:19" ; Friday. strDT2 = "2002:07:20" ; Saturday. strDT3 = "2002:07:21" ; Sunday. strDT4 = "2002:07:22" ; Monday. strDT5 = TimeYmdHms () bIsWeekDay1 = udfIsWeekDay (strDT1) ; @TRUE. bIsWeekDay2 = udfIsWeekDay (strDT2) ; @FALSE. bIsWeekDay3 = udfIsWeekDay (strDT3) ; @FALSE. bIsWeekDay4 = udfIsWeekDay (strDT4) ; @TRUE. bIsWeekDay5 = udfIsWeekDay (strDT5) bIsWeekendDay11 = udfIsWeekendDay (strDT1) ; @FALSE. bIsWeekendDay12 = udfIsWeekendDay (strDT2) ; @TRUE. bIsWeekendDay13 = udfIsWeekendDay (strDT3) ; @TRUE. bIsWeekendDay14 = udfIsWeekendDay (strDT4) ; @FALSE. bIsWeekendDay15 = udfIsWeekendDay (strDT5) bIsWeekendDay21 = !udfIsWeekDay (strDT1) ; @FALSE. bIsWeekendDay22 = !udfIsWeekDay (strDT2) ; @TRUE. bIsWeekendDay23 = !udfIsWeekDay (strDT3) ; @TRUE. bIsWeekendDay24 = !udfIsWeekDay (strDT4) ; @FALSE. bIsWeekendDay25 = !udfIsWeekDay (strDT5) Exit