CFLib.org – Common Function Library Project

millisecondsToDate(strMilliseconds)

Last updated May 20, 2005
Download UDF

author

Steve Parks                                       Steve Parks

Version: 1 | Requires: ColdFusion MX | Library: DateLib

 
Rated 1 time(s). Average Rating: 5.0

Description:
MillisecondsToDate will convert milliseconds (such as timestamps returned by Java objects) and convert them into CF friendly date timestamps.

Return Values:
Returns a date.

Example:

MillisecondsToDate(1095982571858)<BR>
<cfoutput>#MillisecondsToDate(1095982571858)#</cfoutput>

Parameters:

Name Description Required
strMilliseconds The number of milliseconds. Yes

Full UDF Source:

<!---
Converts epoch milleseconds to a date timestamp.

@param strMilliseconds      The number of milliseconds. (Required)
@return Returns a date.
@author Steve Parks (steve@adeptdeveloper.com)
@version 1, May 20, 2005
--->

<cffunction name="millisecondsToDate" access="public" output="false" returnType="date">
    <cfargument name="strMilliseconds" type="string" required="true">
    
    <cfreturn dateAdd("s", strMilliseconds/1000, "january 1 1970 00:00:00")>
</cffunction>

Search CFLib.org


Latest Additions

Shawn Porter Shawn Porter added
DeMoronize
3 hour(s) ago

Chris Carey Chris Carey added
readPropertiesFi...
1 day(s) ago

Randy Johnson Randy Johnson added
lastDayofWeek
3 day(s) ago

Frank Marion Frank Marion added
sitemapPing
7 day(s) ago

Top Rated

James Sleeman                                     QuickSort
Rated 5.0, 3 time(s)

Barney Boisvert indentXml
Rated 5.0, 3 time(s)

Nathan Dintenfass                                 queryColumnsToSt...
Rated 5.0, 3 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 3 time(s)

Created by Raymond Camden / Design by Justin Johnson