Tag Archive: date

last weekday of a month

!---------------------------------------------------------
! Last Weekday of a Month
!---------------------------------------------------------

!Text Equates
SundayText Equate('Sunday')
MondayText Equate('Monday')
TuesdayText Equate('Tuesday')
WednesdayText Equate('Wednesday')
ThursdayText Equate('Thursday')
FridayText Equate('Friday')
SaturdayText Equate('Saturday')


! Numeric Equates
Sunday Equate(1)
Monday Equate(2)
Tuesday Equate(3)
Wednesday Equate(4)
Thursday Equate(5)
Friday Equate(6)
Saturday Equate(7)
LastDayOfMonth Long
AnyDate Long

AnyDate = any given Clarion standard date


LastDayOfMonth = date(month(AnyDate) + 1,1,year(AnyDate)) -1


!Execute some code depening on day of week
Execute (LastDayOfMonth % 7) + 1
 Do SundayRoutine
 Do MondayRoutine
 Do TuesdayRoutine
 Do WednesdayRoutine
 Do ThursdayRoutine
 Do FridayRoutine
 Do SaturdayRoutine
End

! or return a value to a variable
Execute (LastDayOfMonth % 7) + 1
 ?DayText = SundayText
 ?DayText = MondayText
 ?DayText = TuesdayText
 ?DayText = WednesdayText
 ?DayText = ThursdayText
 ?DayText = FridayText
 ?DayText = SaturdayText
End