CFLib.org – Common Function Library Project

date2Timestamp(cfdate)

Last updated September 28, 2006

author

Michael Fritz

Version: 1 | Requires: CF5 | Library: DateLib

Description:
Converts ColdFusion date to linux timestamp using the datefiff algorithm to count the difference in seconds between the given date and the 1970-1-1.

Return Values:
Retuns a number.

Example:

<cfscript>
today = now();
todayInLinux = date2Timestamp(today);
</cfscript>

Parameters:

Name Description Required
cfdate A ColdFusion datetime value. Yes

Full UDF Source:

/**
 * Converts ColdFusion date to linux timestamp.
 * 
 * @param cfdate 	 A ColdFusion datetime value. (Required)
 * @return Retuns a number. 
 * @author Michael Fritz (mitchiru_jo@gmx.de) 
 * @version 1, September 28, 2006 
 */
function date2Timestamp(cfdate) {
	return dateDiff('s',createDate(1970,1,1),cfdate);
}
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