• Subject: RE: Calculating Working(business) days
  • From: "Stone, Brad V (TC)" <bvstone@xxxxxxxxxxxxxx>
  • Date: Thu, 24 Aug 2000 13:24:46 -0500

That was a concern of ours as well, Jim.  But since it was order receive
date and ship date we were using, it shouldn't have ever been more than a
week or two.  :)

Brad

> -----Original Message-----
> From: Jim Langston [mailto:jlangston@conexfreight.com]
> Sent: Thursday, August 24, 2000 10:07 AM
> To: RPG400-L@midrange.com
> Subject: Re: Calculating Working(business) days
> 
> 
> This would work for sure, but my only consideration would be 
> if you ever
> needed a larger date range.  You are cycling through every 
> single date,
> which could take some time.
> 
> But, realistically, how many times are you going to need to know how
> many working days there are for over an extended period of time?
> 
> So I think this code snippet wins for simplicity.
> 
> Regards,
> 
> Jim Langston
> 
> "Stone, Brad V (TC)" wrote:
> 
> > We just had to do this.  We did it using a set of date 
> subprocedures that we
> > have...  went something like this (nasty psudeocode)...
> >
> > Date1 = Start Date
> > Date2 = End Date
> > NumWorkDays = 0
> >
> > dow (Date2 > Date1)
> >   Day = #NameofDay(#DayofWeek(Date2))
> >   if (Day <> 'Saturday') and (Day <> 'Sunday')
> >     NumWorkDays = (NumWorkDays + 1)
> >   endif
> >   Date2 = (Date2 - 1 day)
> > enddo
> >
> > The only realy thing we had to write was #DayofWeek() which 
> when passed a
> > date data type returns a number representing the day (ie 
> 1=Sunday, 2=
> > Monday, etc..)  Then we wrote #NameofDay which when passed 
> a number (1-7)
> > returns the name of the day.
> >
> > I originally wrote these for e-RPG since dates have to be 
> in a funky format
> > for headers, cookies, etc. (like Mon, 10 Dec 2000)  They 
> ended up working
> > for this as well.
> >
> > Now, what we really should do is write another subprocedure 
> that when passed
> > two dates retrieves the number of working days...  That 
> will be the next
> > addition to our F.DATE service program.  :)  ILE rules!!!
> >
> > Brad
> >
> > > -----Original Message-----
> > > From: Jeff Crosby [mailto:jlcrosby@fwi.com]
> > > Sent: Thursday, August 24, 2000 8:12 AM
> > > To: RPG400-L@midrange.com
> > > Subject: Re: Calculating Working(business) days
> > >
> > >
> > > Alan Addison wrote:
> > >
> > > > Take the duration, divide it by five and multiply it by
> > > seven, then add
> > > > that number of days to the starting date.
> > >
> > > Actually, It's not that simple.  The calculated date could
> > > end up being
> > > a Sat or Sun.  Then you have to adjust it.
> > >
> > > --
> > > -Jeff
> > > The opinions expressed are my own and not necessarily
> > > the opinion of my company.  Unless I say so.
> > > +---
> > > | This is the RPG/400 Mailing List!
> > > | To submit a new message, send your mail to 
> RPG400-L@midrange.com.
> > > | To subscribe to this list send email to 
> RPG400-L-SUB@midrange.com.
> > > | To unsubscribe from this list send email to
> > > RPG400-L-UNSUB@midrange.com.
> > > | Questions should be directed to the list owner/operator:
> > > david@midrange.com
> > > +---
> > >
> > +---
> > | This is the RPG/400 Mailing List!
> > | To submit a new message, send your mail to RPG400-L@midrange.com.
> > | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> > | To unsubscribe from this list send email to 
> RPG400-L-UNSUB@midrange.com.
> > | Questions should be directed to the list owner/operator: 
> david@midrange.com
> > +---
> 
> +---
> | This is the RPG/400 Mailing List!
> | To submit a new message, send your mail to RPG400-L@midrange.com.
> | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to 
> RPG400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator: 
> david@midrange.com
> +---
> 
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.