Skip to content

Instantly share code, notes, and snippets.

@seancoyne
Created June 9, 2011 20:06
Show Gist options
  • Select an option

  • Save seancoyne/1017591 to your computer and use it in GitHub Desktop.

Select an option

Save seancoyne/1017591 to your computer and use it in GitHub Desktop.
Convert Twitter Date to ColdFusion Date - UDF
<cfscript>
function twitterDate(date,offset) {
var retDate = listtoarray(date, " ");
var thisDay = retDate[1];
var thisMonth = retDate[2];
var thisDate = retDate[3];
var thisTime = timeformat(retDate[4], "h:mm tt");
var thisYear = retDate[6];
var thisReturn = "";
var thisFormat = "#thisMonth#, #thisDate# #thisYear#";
thisFormat = dateformat(thisFormat, "m/d/yy") & " " & thisTime;
thisFormat = dateadd("s", offset, thisFormat);
thisFormat = dateadd("h", 1, thisFormat);
longFormat = dateformat(thisFormat, "yyyy-mm-dd") & " " & timeformat(thisFormat, "HH:mm:ss");
thisReturn = longFormat;
return thisReturn;
}
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment