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);
}

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

Created by Raymond Camden / Design by Justin Johnson