CFLib.org – Common Function Library Project

getEndOfDayTS(date)

Last updated January 30, 2006

author

Sami Hoda

Version: 1 | Requires: CF5 | Library: DateLib

Description:
A function which returns a End Of Day TimeStamp. For example, 1/1/2000 returns {ts '2000-01-01 23:59:59'}. Useful for SQL queries when users search by date ranges and you need to include all values by the end of a certain date period.

Return Values:
Returns a timestamp.

Example:

<cfset EOD = getEndOfDayTS("1/1/2000")>
<cfoutput>#EOD#</cfoutput>

Parameters:

Name Description Required
date Date to use. Yes

Full UDF Source:

/**
 * A function which returns a End Of Day TimeStamp. For example, 1/1/2000 returns {ts '2000-01-01 23:59:59'}.
 * 
 * @param date 	 Date to use. (Required)
 * @return Returns a timestamp. 
 * @author Sami Hoda (samihoda@gmail.com) 
 * @version 1, January 30, 2006 
 */
function getEndOfDayTS(date) {
	var vDate = date;
	vDate = dateFormat(vDate, 'MM/DD/YYYY');
	vDate = DateAdd("h",23,vDate);
	vDate = DateAdd("n",59,vDate);
	vDate = DateAdd("s",59,vDate);
	
	return vDate;
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson