CFLib.org – Common Function Library Project

date2Timestamp(cfdate)

Last updated September 28, 2006

Version: 1 | Requires: ColdFusion 5 | Library: DateLib

 
Rated 1 time(s). Average Rating: 5.0

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:

view plain print about
<cfscript>
today = now();
todayInLinux = date2Timestamp(today);
</cfscript>

Parameters:

Name Description Required
cfdate A ColdFusion datetime value. Yes

Full UDF Source:

view plain print about
<cfscript>
/**
 * 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);
}
</cfscript>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Tayo Akinmade Tayo Akinmade added
arrayTrim
11 day(s) ago

Will Belden Will Belden added
longTime
17 day(s) ago

James Sleeman James Sleeman added
quickSort
27 day(s) ago

Ben Forta Ben Forta added
GetHostAddress
30 day(s) ago

Top Rated

Darwan Leonardo Sitepu EksporSQLData
Rated 5.0, 16 time(s)

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 13 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson