<?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>Carlo Alducente&#039;s Blog &#187; Format</title>
	<atom:link href="http://labs.alducente.com/tag/format/feed/" rel="self" type="application/rss+xml" />
	<link>http://labs.alducente.com</link>
	<description></description>
	<lastBuildDate>Thu, 12 Nov 2009 01:04:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>AS Time Formatting</title>
		<link>http://labs.alducente.com/2007/11/26/as-time-formatting/</link>
		<comments>http://labs.alducente.com/2007/11/26/as-time-formatting/#comments</comments>
		<pubDate>Mon, 26 Nov 2007 15:33:38 +0000</pubDate>
		<dc:creator>alducente</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Format]]></category>
		<category><![CDATA[Time]]></category>

		<guid isPermaLink="false">http://labs.alducente.com/?p=18</guid>
		<description><![CDATA[I’ve been holding on to this piece of code for almost a year now and I’ve used it several times for many different projects. I have been improving on it every time I used it and thought it was time to share it with everyone. It converts seconds into a nice time format, which can [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve been holding on to this piece of code for almost a year now and I’ve used it several times for many different projects. I have been improving on it every time I used it and thought it was time to share it with everyone. It converts seconds into a nice time format, which can come in handy when working with video. In the example below, passing in <strong>72</strong> seconds in the parameter will return the same amount of time, but in a custom format (hh:mm:ss.ss).</p>
<pre>
trace(returnTime(72)); //traces "00:01:12.00"

function returnTime(seconds:Number):String{
	var minutes = Math.floor(seconds/60);
	var remainingSec = seconds % 60;
	var remainingMinutes = minutes % 60;
	var hours = Math.floor(minutes/60);
	var floatSeconds:Number = Math.floor((remainingSec - Math.floor(remainingSec))*100);
	remainingSec = Math.floor(remainingSec);

	//Edit the formatting below for a custom format
	return (getTwoDigits(hours)+":"+getTwoDigits(remainingMinutes)+":"+getTwoDigits(remainingSec)+"."+getTwoDigits(floatSeconds));
}

function getTwoDigits(number:Number):String{
	if(number &lt; 10){
		return("0"+number);
	} else {
		return number+"";
	}
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://labs.alducente.com/2007/11/26/as-time-formatting/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
