Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-access > #9152

Re: calc first business day of month

From "Phil" <phil@stantonfamily.co.uk>
Newsgroups comp.databases.ms-access
Subject Re: calc first business day of month
Date 2014-03-13 18:40 +0000
Organization Aioe.org NNTP Server
Message-ID <lfsu3o$qef$1@speranza.aioe.org> (permalink)
References <a2d838e8-37a2-4ecd-97ea-ab6de0c16661@googlegroups.com> <78bcfa7e-665c-45b4-9e1f-3a5cbcb6e182@googlegroups.com> <lfslvs$13q7$1@talisker.lacave.net> <c809e3be-cb61-4e23-88a9-3b5952b4dfb5@googlegroups.com>

Show all headers | View raw


On 13/03/2014 16:41:13, Patrick Finucane wrote:
> On Thursday, March 13, 2014 11:22:12 AM UTC-5, kduc wrote:
>> Le 13/03/2014 16:38, Patrick Finucane a écrit : > On Wednesday, March 1
> 2, 2014 11:38:27 AM UTC-5, bobh wrote: >> Hi All, Anyone have vba
> code(they would share) that calculates the date of the first business day
> of a given month? thanks bobh. > > dat = Date() > ? (dat - Day(dat) + 1) +
> 7-Weekda y(dat - Day(dat), vbMonday) Don't forget légal holidays, etc...
> -- kd
> 
> Are there any holidays that would occur on the first Monday of a month?
> 

Depends which country you are in.
UKEaster Monday & First May bank holiday.
Scotland January First

These may help

Public Function EasterDate(Yr As Integer) As Date
     
    Dim Da As Integer
    Da = (((255 - 11 * (Yr Mod 19)) - 21) Mod 30) + 21
EasterDate Date = DateSerial(Yr, 3, 1) + Da + (Da > 48) + 6 - ((Yr + Yr \ 4 +
_     Da + (Da > 48) + 1) Mod 7)
     
End Function

Public Function EasterMonday(Yr As Integer) As Date
    
    EasterMonday = DateAdd("d", 1, EasterDate(Yr))
    
End Function

Public Function FirstSpringHoliday(Yr As Integer) As Date

FirstSpringHoliday iday = DateSerial(Yr, 5, ((7 - Weekday(DateSerial(Yr, 5,
7))) + 2) Mod 7) 'DateSerial(Year(mydte), Month(mydte), ((7 -
Weekday(DateSerial(Year(mydte), Month(mydte), 7))) + 2) mod 7)

End Function

Public Function NewYearsDay(Yr As Integer) As Date

    NewYearsDay = DateSerial(Yr, 1, 1)
    
End Function

Phil

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

Back to comp.databases.ms-access | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

calc first business day of month bobh <vulcaned@yahoo.com> - 2014-03-12 09:38 -0700
  Re: calc first business day of month bobh <vulcaned@yahoo.com> - 2014-03-12 10:21 -0700
    Re: calc first business day of month Neil <xxx@gmail.com> - 2014-03-12 16:26 -0500
  Re: calc first business day of month "Ron Paii" <None@none.com> - 2014-03-12 12:42 -0500
    Re: calc first business day of month bobh <vulcaned@yahoo.com> - 2014-03-12 12:02 -0700
      Re: calc first business day of month "Ron Paii" <None@none.com> - 2014-03-12 14:10 -0500
      Re: calc first business day of month "Ron Paii" <None@none.com> - 2014-03-12 14:21 -0500
  Re: calc first business day of month Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-03-13 08:38 -0700
    Re: calc first business day of month kduc <kduc@numerifil.invalid> - 2014-03-13 17:22 +0100
      Re: calc first business day of month Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-03-13 09:41 -0700
        Re: calc first business day of month "Phil" <phil@stantonfamily.co.uk> - 2014-03-13 18:40 +0000

csiph-web