var reStr = "";
var apiURL = "twitter.com/share"; // TODO: move URL to config element
var apiClass = "twitter-share-button";
var apiCountBoxLayoutOptions = "none,horizontal,vertical";
var apiDefaultLang = "en";
var apiAltLangList = "fr,de,it,es,ko,ja";
var viaUser = TRIM(arguments.via);
var protocol = "http://";
// Check the Protocal of the calling page to and keep call secure if needed
if ( len(trim(cgi.https)) )
protocol = "https://";
//if the viaUser typed in the @ symbol, then we need to remove it
if ( LEN(viaUser) AND (LEFT(viaUser,1) EQ "@") )
viaUser = RIGHT(viaUser,LEN(viaUser)-1);
if ( LEN(arguments.linkClass) )
apiClass = apiClass & " " & arguments.linkClass;
// Load the Twitter Widgets JS header (once per page)
application.ptSocialMedia.socialMediaService.loadTwitterWidgetsJS();
return reStr;
var retDate = listtoarray(dateTime, " ");
var thisDay = retDate[1];
var thisMonth = retDate[2];
var thisDate = retDate[3];
var thisTime = timeformat(retDate[4], "hh:mm:ss tt");
var thisOffset = retDate[5];
var thisYear = retDate[6];
var separator = "T";
var thisFormat = "#thisMonth# #thisDate#, #thisYear#";
var newDateTime = ParseDateTime(dateformat(thisFormat, "mm/dd/yyyy") & " " & thisTime);
var ISOFormat = "";
//var thisISOFormat = "#thisMonth#-#thisDate#-#thisYear##separator##thisTime##thisOffset#";
////thisFormat = dateadd("s", arguments.offset, thisFormat);
//thisFormat = dateadd("h", 1, thisFormat);
////if ( LEN(TRIM(arguments.offset)) )
///thisOffset = "+" & arguments.offset;
//longFormat = dateformat(thisFormat, "yyyy-mm-dd") & " " & timeformat(thisFormat, "HH:mm:ss");
ISOFormat = dateformat(newDateTime, "yyyy-mm-dd") & separator & timeformat(newDateTime,"HH:mm:ss") & thisOffset;
return ISOFormat;
return twitterDateTimeParser(dateTime, offsetVariable);
var retDate = listtoarray(dateTime, " ");
var thisDay = ListFirst(retDate[1],",");
var thisMonth = retDate[3];
var thisDate = retDate[2];
var thisTime = timeformat(retDate[5], "hh:mm:ss tt");
var thisOffset = retDate[6];
var thisYear = retDate[4];
var separator = "T";
var thisFormat = "#thisMonth# #thisDate#, #thisYear#";
var newDateTime = ParseDateTime(dateformat(thisFormat, "mm/dd/yyyy") & " " & thisTime);
var ISOFormat = "";
//var thisISOFormat = "#thisMonth#-#thisDate#-#thisYear##separator##thisTime##thisOffset#";
////thisFormat = dateadd("s", arguments.offset, thisFormat);
//thisFormat = dateadd("h", 1, thisFormat);
////if ( LEN(TRIM(arguments.offset)) )
///thisOffset = "+" & arguments.offset;
//longFormat = dateformat(thisFormat, "yyyy-mm-dd") & " " & timeformat(thisFormat, "HH:mm:ss");
ISOFormat = dateformat(newDateTime, "yyyy-mm-dd") & separator & timeformat(newDateTime,"HH:mm:ss") & thisOffset;
return ISOFormat;