RE: Business days from Dates PLEASE HELP!!!!

2002-03-31 Thread Dharmesh Goel

There is a business days calculator on the cflib.org website as a UDF.

--Dharmesh

-Original Message-
From: Scott Van Vliet [mailto:[EMAIL PROTECTED]]
Sent: Sunday, March 24, 2002 1:53 AM
To: CF-Talk
Subject: Re: Business days from Dates PLEASE HELP


Steven:

Given that business days are generally monday thru friday, you can use the
code below (where date, daysUntilDue  dueDate would be values from your
database).

cfset date = now()
cfset daysUntilDue = 5
cfset dueDate = dateAdd(d, daysUntilDue, date)

cfset businessDays = 2,3,4,5,6
cfset businessDaysUntilDue = 0

cfloop from=#date# to=#dueDate# index=i
 cfif ListFind(businessDays,dayOfWeek(i))
  cfset businessDaysUntilDue = businessDaysUntilDue + 1
 /cfif
/cfloop

cfoutputbusinessDaysUntilDue: #businessDaysUntilDue#/cfoutput

NOTE that this does not cover holidays (such as the US holidays: President's
Day, Thanksgiving, etc.)  To work with this, you could modify the logic as
follows:

!--- Easter, The Fourth of July, Christmas - Day of the Year ---
cfset holidays = 90,185,359

cfloop from=#date# to=#dueDate# index=i
 cfif ListFind(businessDays,dayOfWeek(i))
  cfif NOT ListFind(holidays,dayOfYear(i))
   cfset businessDaysUntilDue = businessDaysUntilDue + 1
  /cfif
 /cfif
/cfloop

Hope this helps!

- Original Message -
From: LANCASTER, STEVEN M. (JSC-OL) (BAR)
[EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Saturday, March 23, 2002 1:56 PM
Subject: Business days from Dates PLEASE HELP


 I have a Database it has a date in one of the columns. I take that date
and
 another column in the table which is just an integer an use the DateAdd
 function to come up with a second date.

 I have:

 date1, duedate(created from the DateAdd function), days_until_it_is_due

 Now I need to give these people X amount of business days based on
 days_until_it_is_due  to come up with a proper due date. Can anyone please
 help me or tell me where to start..

 Steven Lancaster
 

__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Business days from Dates PLEASE HELP!!!!

2002-03-23 Thread Scott Van Vliet

Steven:

Given that business days are generally monday thru friday, you can use the
code below (where date, daysUntilDue  dueDate would be values from your
database).

cfset date = now()
cfset daysUntilDue = 5
cfset dueDate = dateAdd(d, daysUntilDue, date)

cfset businessDays = 2,3,4,5,6
cfset businessDaysUntilDue = 0

cfloop from=#date# to=#dueDate# index=i
 cfif ListFind(businessDays,dayOfWeek(i))
  cfset businessDaysUntilDue = businessDaysUntilDue + 1
 /cfif
/cfloop

cfoutputbusinessDaysUntilDue: #businessDaysUntilDue#/cfoutput

NOTE that this does not cover holidays (such as the US holidays: President's
Day, Thanksgiving, etc.)  To work with this, you could modify the logic as
follows:

!--- Easter, The Fourth of July, Christmas - Day of the Year ---
cfset holidays = 90,185,359

cfloop from=#date# to=#dueDate# index=i
 cfif ListFind(businessDays,dayOfWeek(i))
  cfif NOT ListFind(holidays,dayOfYear(i))
   cfset businessDaysUntilDue = businessDaysUntilDue + 1
  /cfif
 /cfif
/cfloop

Hope this helps!

- Original Message -
From: LANCASTER, STEVEN M. (JSC-OL) (BAR)
[EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Saturday, March 23, 2002 1:56 PM
Subject: Business days from Dates PLEASE HELP


 I have a Database it has a date in one of the columns. I take that date
and
 another column in the table which is just an integer an use the DateAdd
 function to come up with a second date.

 I have:

 date1, duedate(created from the DateAdd function), days_until_it_is_due

 Now I need to give these people X amount of business days based on
 days_until_it_is_due  to come up with a proper due date. Can anyone please
 help me or tell me where to start..

 Steven Lancaster
 
__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: business days

2001-01-18 Thread Dylan Bromby

This might help get you started:

1) get all the dates between 2 dates using something like

SELECT
the_date
FROM
table
WHERE
the_date BETWEEN CreateODBCDate(date1) AND CreateODBCDate(date2)

then

2) on your CFOUTPUT, something like

CFOUTPUT QUERY="queryname"
CFIF #DayOfWeek(the_date)# NEQ 1 AND #DayOfWeek(the_date)# NEQ 7
#the_date#
BR
/CFIF
/CFOUTPUT



-Original Message-
From: Alex [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 17, 2001 5:31 PM
To: CF-Talk
Subject: business days


i am using SQLServer7. is there a function or custom tag to get the number
of
business days between 2 dates?
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: business days

2001-01-18 Thread DeVoil, Nick

There isn't a function in SQL server.

For such a function to work everywhere, you would need to tell it
what country you're in  supply data on what holidays are scheduled.
Often, holidays cannot be  determined programmatically  are not
known very far in advance.

Reuters has this data somewhere. Not sure if it's on the Web.
Maybe Bloomberg too?

Nick

-Original Message-
From: Alex [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 18, 2001 1:31 AM
To: CF-Talk
Subject: business days


i am using SQLServer7. is there a function or custom tag to get the number
of
business days between 2 dates?
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: business days

2001-01-18 Thread Tim Painter

Alex,
Here is how to do it in SQL Server (assuming Saturday and Sunday are not
business days)

Select count(*) as daycount
From DateTable
Where DateTable.EntryDatetime = [beginnindate] AND DateTable.EntryDateTime
= [enddate]
AND ((DateName(dw, DateTable.EntryDatetime) != 'Saturday') AND (DateName(dw,
DateTable.EntryDatetime) != 'Sunday'))

-Original Message-
From: Alex [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 17, 2001 8:31 PM
To: CF-Talk
Subject: business days


i am using SQLServer7. is there a function or custom tag to get the number
of
business days between 2 dates?
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists