May 04

Converting Unix timestamp values in ColdFusion

Posted by James Netherton | Sunday 04 May 2008 4:58 PM | In ColdFusion

I've been working on an application that integrates with a third party payment gateway solution. The payment service sends back a transaction timestamp after a purchase is successfully completed in the unix time format.

I spent some time trying to figure out how to covert this into a 'normal' date format with ColdFusion. The solution is pretty simple as the following code sample demonstrates.

<!--- Unix Timestamp representing 4th May 2008 00:00:00 AM --->
<cfset variables.unixTimeStamp = "1209859200"/>

<cfoutput>#dateAdd("s", variables.unixTimeStamp, "01/01/1970")#</cfoutput>

 

0 Comments

[Post comment]


Leave a comment








Captcha text