GetDB2TimeStamp(dateObj, emulateTick)
Last updated June 27, 2002
Version: 1 | Requires: ColdFusion 5 | 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:
#GetDB2TimeStamp(Now(), "Yes")#<BR>
#GetDB2TimeStamp(Now(), "No")#
</cfoutput>
Parameters:
| Name | Description | Required |
|---|---|---|
| dateObj | A data object. | Yes |
| emulateTick | A boolean. | Yes |
Full UDF Source:
<cfscript>
/**
* 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;
}
</cfscript>
Search CFLib.org
Latest Additions
Tayo Akinmade added
arrayTrim
11 day(s) ago
Will Belden added
longTime
17 day(s) ago
James Sleeman added
quickSort
27 day(s) ago
Ben Forta added
GetHostAddress
30 day(s) ago
Top Rated
EksporSQLData
Rated 5.0, 16 time(s)
backupDatabase
Rated 5.0, 13 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)