I have been googling for hours and have not yet found a solution to this problem.
currently, I retrive the data from the twitter xml file: http://twitter.com/statuses/user_timeline.xml?screen_name=clubbluecanopy
everything works fine, my date format shows this: Fri Aug 12 03:25:40 +0000 2011
But I want it to show this: 17 days ago
here’s my flash as3 code:
var myXMLLoader:URLLoader = new URLLoader();
//myXMLLoader.load(new URLRequest("http://twitter.com/statuses/user_timeline.xml?screen_name=arunshourie"));
myXMLLoader.load(new URLRequest("twitter.php"));
myXMLLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void{
var myXML:XML = new XML(e.target.data);
trace(myXML.status[0].text);
tweet_1.text = String(myXML.status[0].text);
time.text= String(myXML.status[0].created_at);
}
Here’s the php code:
<?php
/*
* @return string
* @param string $url
* @desc Return string content from a remote file
* @author Luiz Miguel Axcar (lmaxcar@yahoo.com.br)
*/
function get_content($url)
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 0);
ob_start();
curl_exec ($ch);
curl_close ($ch);
$string = ob_get_contents();
ob_end_clean();
return $string;
}
#usage:
$content = get_content ("http://twitter.com/statuses/user_timeline.xml?screen_name=clubbluecanopy");
echo $content;
?>
I have used crossdomain.xml as well
would appreciate if someone can help me! thanks! 🙂
Fri Aug 12 03:25:40 +0000 2011means Friday, 12th August 2011, 03hrs 25min 40sec GMTThis is Flash’s native date formatted string
You can create another function which will give you the required output:
You could use it as follows: