Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Last business day of month
Message
 
To
13/03/2002 12:36:31
Jason Dalio
Northern Interior Regional Health Board
Prince George, British Columbia, Canada
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00631995
Message ID:
00632571
Views:
13
Jason - thanks for the tip. I have to get more familiar with the format function in VB - it sure seems to be a function that can do alot of things.

Al


>I just whipped this up real quick to give you the idea. It doesn't handle holidays but gives you the last day unless it is a Saturday or Sunday.
>
>
>Private Function GetLastBusinessDay() As Date
>Dim LastDay As Date
>
>    'get the last day of the month by subtracting one day from the first of the next month
>    LastDay = DateSerial(DatePart("YYYY", Date), DatePart("m", Date) + 1, 0)
>
>    'Check to see if saturday or sunday
>    If Format(LastDay, "dddd") = "Sunday" Then
>        LastDay = LastDay - 2
>    Else
>        If Format(LastDay, "dddd") = "Saturday" Then
>            LastDay = LastDay - 1
>        End If
>    End If
>    GetLastBusinessDay = LastDay
>
>End Function
>
Al Williams

Anola MB, CANADA
Previous
Reply
Map
View

Click here to load this message in the networking platform