CFLib.org – Common Function Library Project

EpochTimeToDate(epoch)

Last updated June 21, 2002
Download UDF

author

Chris Mellon                                      Chris Mellon

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

 
Rated 0 time(s). Average Rating: 0

Description:
Converts a UNIX epoch time to a ColdFusion date object. Epoch time is defined as the number of seconds elapsed since January 1 1970 00:00:00 GMT. This UDF does not take the server's local timezone offset into account when converting from epoch to local time. For that, see EpochTimeToLocalDate().

Return Values:
Returns a date object.

Example:

<cfoutput>
1021385053: #EpochTimeToDate(1021385053)#<br>
0: #EpochTimeToDate(0)#<br>
</cfoutput>

Parameters:

Name Description Required
epoch Epoch time, in seconds. Yes

Full UDF Source:

<cfscript>
/**
* Converts a UNIX epoch time to a ColdFusion date object.
*
* @param epoch      Epoch time, in seconds. (Required)
* @return Returns a date object.
* @author Chris Mellon (mellon@mnr.org)
* @version 1, June 21, 2002
*/

function EpochTimeToDate(epoch) {
return DateAdd("s", epoch, "January 1 1970 00:00:00");
}
</cfscript>

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