Skip to content

Instantly share code, notes, and snippets.

@SimonLlewellyn
SimonLlewellyn / timeago.cfm
Last active May 1, 2017 23:40
CF Function - return how long ago a date/time was: timeAgoFormat(date).short
<cfscript>
function timeAgoFormat(date){
var interval = "";
var offset = 0;
var result = 0;
var res = structNew();
if (isDate(arguments.date)){
var formattedDate = dateFormat(arguments.date, "ddd dd mmm yy");
//& " at " & timeFormat(arguments.date, "HH:MM");
@Macagare
Macagare / gist:3999349
Created November 2, 2012 07:51
Coldfusion: paypal api
<!-- read post from PayPal system and add 'cmd' -->
<CFSET str="cmd=_notify-validate">
<CFLOOP INDEX="TheField" list="#Form.FieldNames#">
<CFSET str = str & "&#LCase(TheField)#=#URLEncodedFormat(Form[TheField])#">
</CFLOOP>
<CFIF IsDefined("FORM.payment_date")>
<CFSET str = str & "&payment_date=#URLEncodedFormat(Form.payment_date)#">
</CFIF>
<CFIF IsDefined("FORM.subscr_date")>
<CFSET str = str & "&subscr_date=#URLEncodedFormat(Form.subscr_date)#">