MySQLDT2TS(dt)
Last updated June 27, 2002
Version: 1 | Requires: ColdFusion 5 | Library: DatabaseLib
Description:
Converts the passed CF datetime into a MySQL timestamp.
Return Values:
Returns a string.
Example:
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:
<cfscript>
/**
* 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');
}
</cfscript>
Search CFLib.org
Latest Additions
Alan McCollough added
forceBoolean
5 day(s) ago
Shawn Porter added
DeMoronize
8 day(s) ago
Chris Carey added
readPropertiesFi...
8 day(s) ago
Randy Johnson added
lastDayofWeek
11 day(s) ago
Top Rated
indentXml
Rated 5.0, 4 time(s)
QuickSort
Rated 5.0, 3 time(s)
queryColumnsToSt...
Rated 5.0, 3 time(s)
generateSsccAsn
Rated 5.0, 3 time(s)