Created
June 9, 2011 20:06
-
-
Save seancoyne/1017591 to your computer and use it in GitHub Desktop.
Convert Twitter Date to ColdFusion Date - UDF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <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