dailyBusinessReportDateRange(dateIn)
Last updated April 4, 2007
Version: 1 | Requires: ColdFusion 5 | 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:
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:
<cfscript>
/**
* 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;
}
</cfscript>
Search CFLib.org
Latest Additions
Tayo Akinmade added
arrayTrim
12 day(s) ago
Will Belden added
longTime
17 day(s) ago
James Sleeman added
quickSort
27 day(s) ago
Ben Forta added
GetHostAddress
30 day(s) ago
Top Rated
EksporSQLData
Rated 5.0, 16 time(s)
backupDatabase
Rated 5.0, 13 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)