Re: Two date pickers
From: Rick Rothstein (rickNOSPAMnews_at_NOSPAMcomcast.net)
Date: 04/08/04
- Next message: Jack: "Re: Why the following code is faster executed when placed in the form?"
- Previous message: Dmitriy Antonov: "Re: select"
- In reply to: Chris: "Re: Two date pickers"
- Next in thread: Chris: "Re: Two date pickers"
- Reply: Chris: "Re: Two date pickers"
- Reply: Bonj: "Re: Two date pickers"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 7 Apr 2004 23:17:18 -0400
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: Jack: "Re: Why the following code is faster executed when placed in the form?"
- Previous message: Dmitriy Antonov: "Re: select"
- In reply to: Chris: "Re: Two date pickers"
- Next in thread: Chris: "Re: Two date pickers"
- Reply: Chris: "Re: Two date pickers"
- Reply: Bonj: "Re: Two date pickers"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|