date - Twitter value into friendly time format at Flash -


I went googling for hours and the problem has not yet been solved.

Currently, I withdraw data from Twitter's XML file:

Everything works well, my date format shows: Venus 12 August 03:25:40 + 0000 2011 but I have to show it: 17 days ago

Here my Flash is as3 code:

  "<"> myXMLLoader: URLLoader = new URLloader (); // myXML loader.load (new URLRequest ("http://twitter.com/statuses/user_timeline.xml?screen_name=arunshourie")); MyXMLLoader.load (new URLRequest ("twitter.php")); MyXMLLoader.addEventListener (Event.Complete, Process XML); Function Process XML (E: Event): Zero {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 is the PHP code:

    

I have also used crossdomain.xml

If someone can help me then I would appreciate it! Thanks! :)

Fri 12 Aug 03:25:40 +0000 2011 Tools Friday, August 12, 2011, 03hrs 25min 40sec GMT

This is the original date formatted string of Flash

You can create another function that will give you the necessary output: < Pre> Private function to redetribute (D: date): string {var: now = date = new date (); Var millisec: int = now.valouf () - d.valueOf (); // lets you num and then between milliseconds between cells: int = int (millisec / 1000); If (second & lt; 60) {return second + "seconds ago"; } And if (seconds & lt; 60 * 60) {return mathematics. (Seconds / 60) + "minutes ago"; } And if (secs & lt; 60 * 60 * 24) {return math ground (sec / (60 * 60)) + "hours ago"; } And {return math (per second / (60 * 60 * 24)) + "day ago"; }}

You can use it as:

  time.text = toRelateivedate (myXML.status [0] .created_at);    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -