GetDB2TimeStamp(dateObj, emulateTick)
Last updated June 27, 2002
Version: 1 | Requires: CF5 | Library: DatabaseLib
Description:
Takes a ColdFusion date object and returns a DB2 formatted timestamp.
A second parameter "emulateTick" determines if tick count emulation is added to the date object.
Return Values:
Returns a string.
Example:
<cfoutput>
#GetDB2TimeStamp(Now(), "Yes")#<BR>
#GetDB2TimeStamp(Now(), "No")#
</cfoutput>
Parameters:
Name | Description | Required |
---|---|---|
dateObj | A data object. | Yes |
emulateTick | A boolean. | Yes |
Full UDF Source:
/**
* Takes a ColdFusion date object and returns a DB2 formatted timestamp.
*
* @param dateObj A data object. (Required)
* @param emulateTick A boolean. (Required)
* @return Returns a string.
* @author Chris Wigginton (cwigginton@macromedia.com)
* @version 1, June 27, 2002
*/
function getDB2TimeStamp(dateObj, emulateTick)
{
var tick = "000000";
// We can partially emulate milliseconds by
//grabbing the current tick and applying it to the date object
if(emulateTick IS "Yes")
tick = Right(GetTickCount(),3) & "000";
return DateFormat(dateObj, "yyyy-mm-dd-") & TimeFormat(dateObj, "HH.mm.ss.") & tick;
}
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