Mar
13
13
First Working Day in Crystal Reports
© 2008 tensixtyone | Theme by DemusDesign and Theme Lab | Powered by WordPress
From time to time, to save on resources and make things easier you have to bodge certain items. Today’s example is generating a different report on the first working day of the month than the rest of the month. Crystal Reports doesn’t offer the functionality to identify the first working day of the month, so i’ve created the following fuction:
Function FirstWorkingDayOfMonth(d as Date)
dim td as date
' Grab the first day of the month and check what day of the week it is
td = datevalue(Year(d),Month(d),1)
select case dayofweek(td,crMonday)
case 6
' Saturday
FirstWorkingDayOfMonth = datevalue(year(d),month(d),3)
case 7
' Sunday
FirstWorkingDayOfMonth = datevalue(year(d),month(d),2)
case else
FirstWorkingDayOfMonth = td
end select
End Function
Just incase this is handy for anyone else.
filed under: home, technology | comments (0) | read more...