<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mike Luby &#187; Actionscript</title>
	<atom:link href="http://www.mikeluby.com/category/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mikeluby.com</link>
	<description>acts smart.</description>
	<lastBuildDate>Wed, 23 Dec 2009 15:45:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AS3 Code Snippet: Covert seconds to simple time stamp</title>
		<link>http://www.mikeluby.com/2008/10/15/as3-code-snippet-covert-seconds-to-simple-time-stamp/</link>
		<comments>http://www.mikeluby.com/2008/10/15/as3-code-snippet-covert-seconds-to-simple-time-stamp/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 16:26:41 +0000</pubDate>
		<dc:creator>Mike Luby</dc:creator>
				<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://lubymike.wordpress.com/?p=80</guid>
		<description><![CDATA[What this code snippet allows is the ability to pass the number of seconds and return a simple time stamp in the form of &#8220;Weeks:Days:Hours:Minutes:Seconds&#8221; with the minimum return of &#8220;Minutes:Seconds&#8221;. A good use of this snippet is in media players to convert the duration of the media to a more readable time stamp.

/**
* Converts [...]]]></description>
			<content:encoded><![CDATA[<p>What this code snippet allows is the ability to pass the number of seconds and return a simple time stamp in the form of &#8220;Weeks:Days:Hours:Minutes:Seconds&#8221; with the minimum return of &#8220;Minutes:Seconds&#8221;. A good use of this snippet is in media players to convert the duration of the media to a more readable time stamp.</p>
<pre class="brush: jscript;">
/**
* Converts seconds to minutes and seconds
* @param number Number of seconds
* @return String of minutes and seconds (00:00)
*/
public function convertTime( number:Number ):String {
	number = Math.abs( number );
	var val:Array = new Array( 5 );
		val[ 0 ] = Math.floor( number / 86400 / 7 ); //weeks
		val[ 1 ] = Math.floor( number / 86400 % 7 );//days
		val[ 2 ] = Math.floor( number / 3600 % 24 );//hours
		val[ 3 ] = Math.floor( number / 60 % 60 );//mins
		val[ 4 ] = Math.floor( number % 60 );//secs
	var stopage:Boolean = false;
	var cutIndex:Number  = -1;
	for(var i:Number = 0; i &lt; val.length; i++ ) {
		if( val[ i ] &lt; 10 )
			val[ i ] = &quot;0&quot; + val[ i ];
		if( val[ i ] == &quot;00&quot; &amp;&amp; i &lt; ( val.length - 2 ) &amp;&amp; !stopage ) {
			cutIndex = i;
		} else {
			stopage = true;
		}
	}
	val.splice( 0, cutIndex + 1 );
	return val.join( &quot;:&quot; );
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeluby.com/2008/10/15/as3-code-snippet-covert-seconds-to-simple-time-stamp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
