Days between two dates based on calendar

Early disclaimer... I am not a programmer. I have successfully (so far) snowed everyone I work with here, but make no claims amongst a group of actual professionals.

 

That said, could you create in ABL logic similar to:

 

NumberOfDays = EndDate - StartDate

 

Loop: for each ProdCalDay where ProdCalDay.ModifiedDay > StartDate AND ProdCalDay.ModifiedDay < EndDate

if ProdCalDay.WorkingDay = FALSE then OffDays = OffDays +1

 

CalculatedDays = NumberOfDays - OffDays

 

If this provides you with nothing but a good laugh, then my day is also complete...

 

Ernie Lowell

Diba Industries



---In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:

I understand how to set up Calendars.  My challenge is how do I figure out the number of work days based on a calendar between two dates.

 

Example:  “ PORel.PromiseDt – TODAY “ gives me the number of days until the promise date.

 

If needed, I could calculate the number of weeks between days, take into account what day of the week it is now, and could eventually get to the number of workdays.   A glorified version of “ PORel.PromiseDt – TODAY – trunc ((PORel.PromiseDt – TODAY) / 7 * 2) is a good approximation of the number of weekdays between the two days.

 

I just don’t know if anyone has some way of taking into account a calendar.

 

Thanks again.

 

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of gracefulthreads@...
Sent: Thursday, October 24, 2013 8:31 AM
To: vantage@yahoogroups.com
Subject: [Vantage] RE: Days between two dates based on calendar

 

 

Kevin,

 

Use the Production Calendar to set weekends and holidays as non-work days (if your company default production calendar shows weekends as WORKING days, just create a second one). I'm doing that in a couple of BPMs to reset Sales Order and Purchase Order dates... it will be a little hairier in a BAQ but should be doable.

 

Ernie Lowell

Diba Industries



---In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:

Does anyone know of a way to calculate the number of working days between two dates and base that on the working days of a calendar.

 

For example, if I have a company calendar that has only M-F as work days, and then has the Thu-Fri off for Thanksgiving, if I want to calculate the days between 10/31/13 and 11/30/13, it would return 19 days (30 days, less 9 weekend days, less the two holidays)?


I’m trying to do this in a BAQ.

 

Thanks.

Kevin Simon

Does anyone know of a way to calculate the number of working days between two dates and base that on the working days of a calendar.

 

For example, if I have a company calendar that has only M-F as work days, and then has the Thu-Fri off for Thanksgiving, if I want to calculate the days between 10/31/13 and 11/30/13, it would return 19 days (30 days, less 9 weekend days, less the two holidays)?


I’m trying to do this in a BAQ.

 

Thanks.

Kevin Simon

Kevin,

 

Use the Production Calendar to set weekends and holidays as non-work days (if your company default production calendar shows weekends as WORKING days, just create a second one). I'm doing that in a couple of BPMs to reset Sales Order and Purchase Order dates... it will be a little hairier in a BAQ but should be doable.

 

Ernie Lowell

Diba Industries



---In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:

Does anyone know of a way to calculate the number of working days between two dates and base that on the working days of a calendar.

 

For example, if I have a company calendar that has only M-F as work days, and then has the Thu-Fri off for Thanksgiving, if I want to calculate the days between 10/31/13 and 11/30/13, it would return 19 days (30 days, less 9 weekend days, less the two holidays)?


I’m trying to do this in a BAQ.

 

Thanks.

Kevin Simon

I understand how to set up Calendars. My challenge is how do I figure out the number of work days based on a calendar between two dates.

 

Example: “ PORel.PromiseDt – TODAY “ gives me the number of days until the promise date.

 

If needed, I could calculate the number of weeks between days, take into account what day of the week it is now, and could eventually get to the number of workdays.  A glorified version of “ PORel.PromiseDt – TODAY – trunc ((PORel.PromiseDt – TODAY) / 7 * 2) is a good approximation of the number of weekdays between the two days.

 

I just don’t know if anyone has some way of taking into account a calendar.

 

Thanks again.

 

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of gracefulthreads@...
Sent: Thursday, October 24, 2013 8:31 AM
To: vantage@yahoogroups.com
Subject: [Vantage] RE: Days between two dates based on calendar

 

 

Kevin,

 

Use the Production Calendar to set weekends and holidays as non-work days (if your company default production calendar shows weekends as WORKING days, just create a second one). I'm doing that in a couple of BPMs to reset Sales Order and Purchase Order dates... it will be a little hairier in a BAQ but should be doable.

 

Ernie Lowell

Diba Industries



---In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:

Does anyone know of a way to calculate the number of working days between two dates and base that on the working days of a calendar.

 

For example, if I have a company calendar that has only M-F as work days, and then has the Thu-Fri off for Thanksgiving, if I want to calculate the days between 10/31/13 and 11/30/13, it would return 19 days (30 days, less 9 weekend days, less the two holidays)?


I’m trying to do this in a BAQ.

 

Thanks.

Kevin Simon

I have done this in SQL. But doubt its possible in BAQ


Jose C Gomez

Software Engineer


T: 904.469.1524 mobile
E: jose@…

http://www.josecgomez.com
     Â


Quis custodiet ipsos custodes?


On Thu, Oct 24, 2013 at 9:15 AM, SimsTrak Consulting <simstrak@...> wrote:

Â
<div>
  
  
  <p></p><div><p class="ygrps-yiv-134150714MsoNormal"><span style="font-size:11.0pt;color:#1f497d;">I understand how to set up Calendars.  My challenge is how do I figure out the number of work days based on a calendar between two dates. <u></u><u></u></span></p>

Â

Example: “ PORel.PromiseDt – TODAY “ gives me the number of days until the promise date.

Â

If needed, I could calculate the number of weeks between days, take into account what day of the week it is now, and could eventually get to the number of workdays.  A glorified version of “ PORel.PromiseDt – TODAY – trunc ((PORel.PromiseDt – TODAY) / 7 * 2) is a good approximation of the number of weekdays between the two days.

Â

I just don’t know if anyone has some way of taking into account a calendar.

Â

Thanks again.

Â

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of gracefulthreads@...

Sent: Thursday, October 24, 2013 8:31 AM
To: vantage@yahoogroups.com
Subject: [Vantage] RE: Days between two dates based on calendar

Â

Â

Kevin,

Â

Use the Production Calendar to set weekends and holidays as non-work days (if your company default production calendar shows weekends as WORKING days, just create a second one). I'm doing that in a couple of BPMs to reset Sales Order and Purchase Order dates... it will be a little hairier in a BAQ but should be doable.

Â

Ernie Lowell

Diba Industries



---In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:

Does anyone know of a way to calculate the number of working days between two dates and base that on the working days of a calendar.

Â

For example, if I have a company calendar that has only M-F as work days, and then has the Thu-Fri off for Thanksgiving, if I want to calculate the days between 10/31/13 and 11/30/13, it would return 19 days (30 days, less 9 weekend days, less the two holidays)?


I’m trying to do this in a BAQ.

Â

Thanks.

Kevin Simon

</div>
 


<div style="color:#fff;min-height:0;"></div>