Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Last business day of month
Message
 
À
13/03/2002 12:36:31
Jason Dalio
Northern Interior Regional Health Board
Prince George, Colombie Britannique, Canada
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00631995
Message ID:
00632571
Vues:
14
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform