getBegOfDayTS(date)
Last updated January 30, 2006
Version: 1 | Requires: ColdFusion 5 | Library: DateLib
Description:
A function which returns a Beginning Of Day TimeStamp. For example, 1/1/2000 10:30 PM returns {ts '2000-01-01 00:00:00'}.
Useful for SQL queries when users search by date ranges and you need to include all values by the beginning of a certain date period.
Return Values:
Returns a timestamp.
Example:
<cfoutput>#BOD#</cfoutput>
Parameters:
| Name | Description | Required |
|---|---|---|
| date | Date to use. | Yes |
Full UDF Source:
<cfscript>
/**
* A function which returns a Beginning Of Day TimeStamp. For example, 1/1/2000 10:30 PM returns {ts '2000-01-01 00:00:00'}.
*
* @param date Date to use. (Required)
* @return Returns a timestamp.
* @author Sami Hoda (samihoda@gmail.com)
* @version 1, January 30, 2006
*/
function getBegOfDayTS(date) {
var vDate = date;
vDate = dateFormat(vDate, 'MM/DD/YYYY');
vDate = DateAdd("h",00,vDate);
vDate = DateAdd("n",00,vDate);
vDate = DateAdd("s",00,vDate);
return vDate;
}
</cfscript>
Search CFLib.org
Latest Additions
Dave Anderson added
iniToStruct
20 day(s) ago
Dave Anderson added
deDupeArray
20 day(s) ago
Richard added
dice
22 day(s) ago
Isaac Dealey added
getRelative
a while ago
Top Rated
backupDatabase
Rated 5.0, 22 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)
highlightAndCrop
Rated 5.0, 4 time(s)