dailyBusinessReportDateRange(dateIn)
Last updated April 04, 2007
Version: 1 | Requires: CF5 | Library: DateLib
Description:
Returns a time range for a particular date from midnight to 11:59:59 the same day. If it is a Monday, the start date range begins from Saturday 12:00 AM till end of day Monday. This is helpful for reports run on business days. Usually a process runs 7 days a week early in the morning but a report is run manually only from Monday to Friday. So every day of the week except for Monday gets data for that day. On Monday, current days data as well as weekend's data are lumped together.
Return Values:
Returns a string.
Example:
Any day except Monday : <cfoutput>#dailyBusinessReportDateRange('10/24/2006')#</cfoutput><br>
A Monday : <cfoutput>#dailyBusinessReportDateRange('10/23/2006')#</cfoutput><br>
Current Date : <cfoutput>#dailyBusinessReportDateRange(Now())#</cfoutput><br>
Parameters:
Name | Description | Required |
---|---|---|
dateIn | Date value to use for range. | Yes |
Full UDF Source:
/**
* Returns a time range for a particular date from midnight to 11:59:59 the same day except for Monday.
*
* @param dateIn Date value to use for range. (Required)
* @return Returns a string.
* @author Dharmesh Goel (drgoel@yahoo.com)
* @version 1, April 4, 2007
*/
function dailyBusinessReportDateRange(dateIn) {
var dateRange = "";
var dateOut1 = "";
var dateOut2 = "";
dateIn = dateFormat(dateIn, 'MM/DD/YYYY');
if(dayOfWeek(dateIn) EQ 2) {
dateOut1 = dateAdd("d",-2,dateIn);
dateOut2 = dateadd("s",-1,dateAdd("d",1,dateIn));
} else {
dateOut1 = dateAdd("d",0,dateIn);
dateOut2 = dateadd("s",-1,dateAdd("d",1,dateIn));
}
dateRange = dateout1 & "," & dateOut2;
return dateRange;
}
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016