We do something similar for calculating ship date based on shipping method
and customer required date. Time enters in because 2:00 PM is our cut-off
time for orders to ship the same day.
What you will want to do is loop through the days involved from start_date
to end_date. Check each day to decide if it is a weekend or holiday, which
you can discard. For all other days, check if they are the start or the end
date . . . if not they consist of a full work day . . . if they are, then
you only need to work with the time component.
Dan
-----Original Message-----
From: Tom Dyson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 06, 2000 3:44 AM
To: [EMAIL PROTECTED]
Subject: custom tag for calculating business hours
I'm struggling to write a tag that will give me the number of business hours
between two specified date/time fields. What I want is something like this:
<cf_businesshours bh_start = #starttime# bh_end = #endtime# >
which will give me the total hours, not including weekends, bank holidays
(which are supplied as a list variable #application.holidays#) and non-work
hours (e.g. 6pm to 9am - again supplied as application variables #workstart#
and #workfinish#).
e.g. if #starttime# was friday june 10th 15.00 and #endtime# was monday june
13th 10.00 #businesshours# would be 4.
The tag is for an extranet application where we need to check whether or not
users have performed a specific task within x working hours of accepting it.
In most cases it will run as a scheduled query and bh_end will equal
#now()#.
I can work it on in terms of days (using the DateDiff function) but it's
tricky to find out which hours fall on which days. Has anyone written
something like this? Or do you have any suggestions on how I should go about
it?
Please copy any responses me as well as to the list (I'm subscribed to the
archived version).
Thanks very much
Tom
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.