CFChartDateFormat(date)
Last updated October 18, 2002
Version: 1 | Requires: ColdFusion 5 | Library: DateLib
Description:
Formats a date/time value for use on the y-axis in CFCHART. CFCHART expects date/time values in epoch seconds, adjusted to UTC offset, and multiplied by 1000. Very strange, but it works.
Return Values:
Returns a numeric value.
Example:
<CFCHARTSERIES TYPE="Scatter" SERIESLABEL="New Years Eve Party Hosts">
<CFCHARTDATA ITEM="Zack" VALUE="#cfchartDateFormat("12/31/1972")#">
<CFCHARTDATA ITEM="Becky" VALUE="#cfchartDateFormat("12/31/1996")#">
<CFCHARTDATA ITEM="Joe" VALUE="#cfchartDateFormat("12/31/1984")#">
<CFCHARTDATA ITEM="Lynda" VALUE="#cfchartDateFormat("12/31/2002")#">
</CFCHARTSERIES>
</CFCHART>
Parameters:
| Name | Description | Required |
|---|---|---|
| date | Date/time value you want formatted for CFCHART. | Yes |
Full UDF Source:
<cfscript>
/**
* Formats a date/time value for use on the y-axis in CFCHART.
*
* @param date Date/time value you want formatted for CFCHART. (Required)
* @return Returns a numeric value.
* @author Rob Brooks-Bilson (rbils@amkor.com)
* @version 1, October 18, 2002
*/
function cfchartDateFormat() {
var datetime = 0;
if (ArrayLen(Arguments) eq 0) {
datetime = Now();
}
else {
datetime = arguments[1];
}
return numberFormat(DateDiff("s", DateConvert("utc2Local", "January 1 1970 00:00"), datetime) * 1000);
}
</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)