Re: Two date pickers
From: Bonj (a_at_b.com)
Date: 04/08/04
- Next message: BeastFish: "Re: VB.NET and Excel"
- Previous message: Bonj: "Re: Problems with Sheridan Data Widgets and WinXP"
- In reply to: Rick Rothstein: "Re: Two date pickers"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 8 Apr 2004 20:49:01 +0100
ooooh I'm sure you could eliminate that loop
not promising anything though... but i'll try in a bit
"Rick Rothstein" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in message
news:unA17fRHEHA.2576@TK2MSFTNGP09.phx.gbl...
> 1. You shouldn't have to worry about that. Dates are stored as Doubles; it
> is only when you display them or assign them from Strings that regional
> settings come into play. If you take the DatePicker's Value property and
> assign it to a Date variable, VB should take care of the rest for you.
>
> 2. Take the dates from the DatePicker controls and assign them to Date
> variables and then feed those Date variables into this function which will
> return the number of workdays (not Saturday or Sunday) between two dates
>
> Function WorkDays(StartDate As Date, EndDate As Date) As Long
> Dim NumWeeks As Long
> NumWeeks = (EndDate - StartDate) \ 7
> WorkDays = NumWeeks * 5
> For D = (StartDate + NumWeeks * 7) To EndDate
> If (Weekday(D) Mod 6) <> 1 Then WorkDays = WorkDays + 1
> Next D
> End Function
>
> You'll have to construct a separate function if you want to count the
> holidays between the two dates.
>
> Rick - MVP
>
>
>
> "Chris" <chrispow88NOSPAM@hotmail.com> wrote in message
> news:4074bd57$0$16572$5a62ac22@freenews.iinet.net.au...
> > Hi,
> >
> > 1. Cannot use 'JUNE' etc for month name as this will vary.
> > 2. I may need to let the user decide on what is a weekend Sat/Sun or
> > Fri/Sat but as a first cut just assume Sat/Sun.
> >
> > That's all I was thinking.
> >
> > Thanks
> >
> > Chris
> >
> > "Rick Rothstein" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in message
> > news:uqoy%23ERHEHA.3576@TK2MSFTNGP10.phx.gbl...
> > > > Can anyone suggest how to do the following:
> > > >
> > > > I have two date pickers dp1 and dp2 and I can find the numbers of
days
> > > > between them.
> > > >
> > > > So I can say Fred has been available for work from dp1 to dp2.
> > > >
> > > > But how do I work out how many weekends are in that range, so I can
> > > remove
> > > > them from the number of days worked, taking into account
international
> > > > variations?
> > > >
> > > > Has anyone got any sample code I can look at?
> > >
> > > What are the "international variations" that you want your code to
take
> > into
> > > account?
> > >
> > > Rick - MVP
> > >
> > >
> >
> >
>
>
- Next message: BeastFish: "Re: VB.NET and Excel"
- Previous message: Bonj: "Re: Problems with Sheridan Data Widgets and WinXP"
- In reply to: Rick Rothstein: "Re: Two date pickers"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|