CFLib.org – Common Function Library Project

MySQLDT2TS(dt)

Last updated June 27, 2002

author

Mark Andrachek

Version: 1 | Requires: CF5 | Library: DatabaseLib

Description:
Converts the passed CF datetime into a MySQL timestamp.

Return Values:
Returns a string.

Example:

<CFOUTPUT>
The current time in MySQL timestamp: 
#MySQLDT2TS(Now())#<BR>
<I>(Note - due to page caching, the time value will not change.)</I>
</CFOUTPUT>

Parameters:

Name Description Required
dt Date object. Yes

Full UDF Source:

/**
 * Converts a CF DateTime object into a MySQL timestamp.
 * 
 * @param dt 	 Date object. (Required)
 * @return Returns a string. 
 * @author Mark Andrachek (hallow@webmages.com) 
 * @version 1, June 27, 2002 
 */
function MySQLDT2TS(dt) {
	return Year(dt) & NumberFormat(Month(dt),'00') & NumberFormat(Day(dt),'00') & NumberFormat(Hour(dt),'00') & NumberFormat(Minute(dt),'00') & NumberFormat(Second(dt),'00');
}
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