<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: HOWTO: Using AS3 to Get Age from Birthday (Birthdate)</title>
	<atom:link href="http://drawlogic.com/2008/04/16/howto-using-as3-to-get-age-from-birthday-birthdate/feed/" rel="self" type="application/rss+xml" />
	<link>http://drawlogic.com/2008/04/16/howto-using-as3-to-get-age-from-birthday-birthdate/</link>
	<description>interactive and game development technologies for the web - flash, flex, unity3d, silverlight, javascript</description>
	<lastBuildDate>Fri, 18 May 2012 16:16:36 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Seba</title>
		<link>http://drawlogic.com/2008/04/16/howto-using-as3-to-get-age-from-birthday-birthdate/comment-page-1/#comment-761</link>
		<dc:creator>Seba</dc:creator>
		<pubDate>Wed, 22 Oct 2008 06:08:34 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/?p=188#comment-761</guid>
		<description>A new version, previous one had an error, please ignore previous post.

Thanks

var dateNow:Date = new Date();
var checkDate:String = &quot;12/22/2000&quot;;
var dateBirthday:Date = dateStringToObject(checkDate);
trace(&quot;dateNow = &quot;+dateNow);
trace(&quot;dateBirthday = &quot;+dateBirthday);
calculateAge(dateBirthday)

function calculateAge(birthdate:Date):void {
    var dtNow:Date = new Date();// gets current date
    var currentMonth:Number = dtNow.getMonth() + 1 ;
    var currentDay:Number = dtNow.getDate();
    var currentYear:Number = dtNow.getFullYear();

	var bdMonth:Number = birthdate.getMonth() + 1;
    var bdDay:Number = birthdate.getDate();
    var bdYear:Number = birthdate.getFullYear();

	// get the difference in years
    var years:Number = dtNow.getFullYear() - birthdate.getFullYear();
    var months:Number
    var weeks:Number
    var days:Number

	// subtract another year if we&#039;re before the
    // birth day in the current year
    if (currentMonth &lt; bdMonth &#124;&#124; (currentMonth == bdMonth &amp;&amp; currentDay  bdMonth){ // Current Mont is Bigger than Birthday Month

		months = currentMonth - bdMonth - 1
		if(currentDay &gt; bdDay){
			months++
			days = currentDay - bdDay
			weeks = Math.floor(days / 7)
			days %=7

		}else if(currentDay == bdDay){
			months++
			days = 0;
			weeks = 0
		}else{// currentDay is smaller than bdDay
			// this is not trivial
			// here we calculate the days from the bdDay of the previous month + currentDay
			days =  getDays(currentMonth - 1, dtNow) - bdDay + currentDay
			weeks = Math.floor(days / 7)
			days %=7
		}
	}else if(currentMonth == bdMonth){

		if(currentDay &gt; bdDay){
			months = 0
			days = currentDay - bdDay
			weeks = Math.floor(days / 7)
			days %=7
		}else if(currentDay == bdDay){
			months = 0
			days = 0
			weeks = 0
		}else{// currentDay is smaller than bdDay
			months = 11
			days =  getDays(currentMonth - 1, dtNow) - bdDay + currentDay
			weeks = Math.floor(days / 7)
			days %=7
		}
	}else{ // this is when the currentMonth is smaller than bdMonth
		months = (12 - bdMonth) + (currentMonth - 1)

		if(currentDay &gt; bdDay){
			months++
			days = currentDay - bdDay
			weeks = Math.floor(days / 7)
			days %=7
		}else if(currentDay == bdDay){
			months++
			days = 0
			weeks = 0
		}else{// currentDay is smaller than bdDay
			days =  getDays(currentMonth - 1, dtNow) - bdDay + currentDay
			weeks = Math.floor(days / 7)
			days %=7
		}
	}


	trace (&quot;age:&quot; + years)
	trace (&quot;months:&quot; + months)
	trace (&quot;weeks:&quot; + weeks)
	trace (&quot;days:&quot; + days)

	//var time:String = years + &quot; years, &quot; + months + &quot; months, &quot; + weeks + &quot; weeks, &quot; + days + &quot; days old&quot; ;
}

function getDays(previousMonth:Number, nowDate:Date):Number{

	var isLeap:Boolean = (nowDate.getFullYear()%4) == 0
	trace(&quot;Is leap =&quot; + isLeap)
	trace(&quot;previousMonth=&quot; + previousMonth )
	switch(previousMonth){
		case 0:/*Dec*/ return 31
		case 1:/*Jan*/ return 31
		case 2:/*Feb*/ if (isLeap == 0){ return 29 }else{ return 28 }
		case 3:/*Mar*/ return 31
		case 4:/*Apr*/ return 30
		case 5:/*May*/ return 31
		case 6:/*Jun*/ return 30
		case 7:/*Jul*/ return 31
		case 8:/*Aug*/ return 31
		case 9:/*Sep*/ return 30
		case 10:/*Oct*/	return 31
		case 11:/*Nov*/ return 30
	}
	return 0
}

function dateStringToObject(dateString):Date {
    var date_ar = dateString.split(&quot;/&quot;);
    return new Date(date_ar[2],date_ar[0] - 1,date_ar[1]);
}</description>
		<content:encoded><![CDATA[<p>A new version, previous one had an error, please ignore previous post.</p>
<p>Thanks</p>
<p>var dateNow:Date = new Date();<br />
var checkDate:String = &#8220;12/22/2000&#8243;;<br />
var dateBirthday:Date = dateStringToObject(checkDate);<br />
trace(&#8220;dateNow = &#8220;+dateNow);<br />
trace(&#8220;dateBirthday = &#8220;+dateBirthday);<br />
calculateAge(dateBirthday)</p>
<p>function calculateAge(birthdate:Date):void {<br />
    var dtNow:Date = new Date();// gets current date<br />
    var currentMonth:Number = dtNow.getMonth() + 1 ;<br />
    var currentDay:Number = dtNow.getDate();<br />
    var currentYear:Number = dtNow.getFullYear();</p>
<p>	var bdMonth:Number = birthdate.getMonth() + 1;<br />
    var bdDay:Number = birthdate.getDate();<br />
    var bdYear:Number = birthdate.getFullYear();</p>
<p>	// get the difference in years<br />
    var years:Number = dtNow.getFullYear() &#8211; birthdate.getFullYear();<br />
    var months:Number<br />
    var weeks:Number<br />
    var days:Number</p>
<p>	// subtract another year if we&#8217;re before the<br />
    // birth day in the current year<br />
    if (currentMonth &lt; bdMonth || (currentMonth == bdMonth &amp;&amp; currentDay  bdMonth){ // Current Mont is Bigger than Birthday Month</p>
<p>		months = currentMonth &#8211; bdMonth &#8211; 1<br />
		if(currentDay &gt; bdDay){<br />
			months++<br />
			days = currentDay &#8211; bdDay<br />
			weeks = Math.floor(days / 7)<br />
			days %=7</p>
<p>		}else if(currentDay == bdDay){<br />
			months++<br />
			days = 0;<br />
			weeks = 0<br />
		}else{// currentDay is smaller than bdDay<br />
			// this is not trivial<br />
			// here we calculate the days from the bdDay of the previous month + currentDay<br />
			days =  getDays(currentMonth &#8211; 1, dtNow) &#8211; bdDay + currentDay<br />
			weeks = Math.floor(days / 7)<br />
			days %=7<br />
		}<br />
	}else if(currentMonth == bdMonth){</p>
<p>		if(currentDay &gt; bdDay){<br />
			months = 0<br />
			days = currentDay &#8211; bdDay<br />
			weeks = Math.floor(days / 7)<br />
			days %=7<br />
		}else if(currentDay == bdDay){<br />
			months = 0<br />
			days = 0<br />
			weeks = 0<br />
		}else{// currentDay is smaller than bdDay<br />
			months = 11<br />
			days =  getDays(currentMonth &#8211; 1, dtNow) &#8211; bdDay + currentDay<br />
			weeks = Math.floor(days / 7)<br />
			days %=7<br />
		}<br />
	}else{ // this is when the currentMonth is smaller than bdMonth<br />
		months = (12 &#8211; bdMonth) + (currentMonth &#8211; 1)</p>
<p>		if(currentDay &gt; bdDay){<br />
			months++<br />
			days = currentDay &#8211; bdDay<br />
			weeks = Math.floor(days / 7)<br />
			days %=7<br />
		}else if(currentDay == bdDay){<br />
			months++<br />
			days = 0<br />
			weeks = 0<br />
		}else{// currentDay is smaller than bdDay<br />
			days =  getDays(currentMonth &#8211; 1, dtNow) &#8211; bdDay + currentDay<br />
			weeks = Math.floor(days / 7)<br />
			days %=7<br />
		}<br />
	}</p>
<p>	trace (&#8220;age:&#8221; + years)<br />
	trace (&#8220;months:&#8221; + months)<br />
	trace (&#8220;weeks:&#8221; + weeks)<br />
	trace (&#8220;days:&#8221; + days)</p>
<p>	//var time:String = years + &#8221; years, &#8221; + months + &#8221; months, &#8221; + weeks + &#8221; weeks, &#8221; + days + &#8221; days old&#8221; ;<br />
}</p>
<p>function getDays(previousMonth:Number, nowDate:Date):Number{</p>
<p>	var isLeap:Boolean = (nowDate.getFullYear()%4) == 0<br />
	trace(&#8220;Is leap =&#8221; + isLeap)<br />
	trace(&#8220;previousMonth=&#8221; + previousMonth )<br />
	switch(previousMonth){<br />
		case 0:/*Dec*/ return 31<br />
		case 1:/*Jan*/ return 31<br />
		case 2:/*Feb*/ if (isLeap == 0){ return 29 }else{ return 28 }<br />
		case 3:/*Mar*/ return 31<br />
		case 4:/*Apr*/ return 30<br />
		case 5:/*May*/ return 31<br />
		case 6:/*Jun*/ return 30<br />
		case 7:/*Jul*/ return 31<br />
		case 8:/*Aug*/ return 31<br />
		case 9:/*Sep*/ return 30<br />
		case 10:/*Oct*/	return 31<br />
		case 11:/*Nov*/ return 30<br />
	}<br />
	return 0<br />
}</p>
<p>function dateStringToObject(dateString):Date {<br />
    var date_ar = dateString.split(&#8220;/&#8221;);<br />
    return new Date(date_ar[2],date_ar[0] &#8211; 1,date_ar[1]);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seba</title>
		<link>http://drawlogic.com/2008/04/16/howto-using-as3-to-get-age-from-birthday-birthdate/comment-page-1/#comment-760</link>
		<dc:creator>Seba</dc:creator>
		<pubDate>Wed, 22 Oct 2008 05:58:00 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/?p=188#comment-760</guid>
		<description>Hi Guys, I am using this in an application we have developed. Just based on initial code. It may need some cleanup and optimization, but wanted to put it in here as a beta version :)


var dateNow:Date = new Date();
var checkDate:String = &quot;12/22/2000&quot;;
var dateBirthday:Date = dateStringToObject(checkDate);
trace(&quot;dateNow = &quot;+dateNow);
trace(&quot;dateBirthday = &quot;+dateBirthday);
calculateAge(dateBirthday)

function calculateAge(birthdate:Date):Number {
    var dtNow:Date = new Date();// gets current date
    var currentMonth:Number = dtNow.getMonth() + 1 ;
    var currentDay:Number = dtNow.getDate();
    var currentYear:Number = dtNow.getFullYear();

	var bdMonth:Number = birthdate.getMonth() + 1;
    var bdDay:Number = birthdate.getDate();
    var bdYear:Number = birthdate.getFullYear();

	// get the difference in years
    var years:Number = dtNow.getFullYear() - birthdate.getFullYear();
    var months:Number
    var weeks:Number
    var days:Number

	// subtract another year if we&#039;re before the
    // birth day in the current year
    if (currentMonth &lt; bdMonth &#124;&#124; (currentMonth == bdMonth &amp;&amp; currentDay  bdMonth){
		months = currentMonth - bdMonth - 1

		if(currentDay &gt; bdDay){
			months++
			days = currentDay - bdDay
			weeks = Math.floor(days / 7)
			days %=7

		}else if(currentDay == bdDay){
			months++
			days = 0;
			weeks = 0
		}else{// currentDay is smaller than bdDay
			// this is not trivial
			// here we calculate the days from the bdDay of the previous month + currentDay
			days =  getDays(currentMonth - 1, dtNow) - bdDay + currentDay
			weeks = Math.floor(days / 7)
			days %=7
		}
	}else if(currentMonth == bdMonth){

		if(currentDay &gt; bdDay){
			months = 0
			days = currentDay - bdDay
			weeks = Math.floor(days / 7)
			days %=7
		}else if(currentDay == bdDay){
			months = 0
			days = 0
			weeks = 0
		}else{// currentDay is smaller than bdDay
			months = 11
			days =  getDays(currentMonth - 1, dtNow) - bdDay + currentDay
			weeks = Math.floor(days / 7)
			days %=7
		}
	}else{ // this is when the currentMonth is smaller than bdMonth
		months = (12 - bdMonth) + (currentMonth - 1)

		if(currentDay &gt; bdDay){
			months++
			days = currentDay - bdDay
			weeks = Math.floor(days / 7)
			days %=7
		}else if(currentDay == bdDay){
			months++
			days = 0
			weeks = 0
		}else{// currentDay is smaller than bdDay
			days =  getDays(currentMonth - 1, dtNow) - bdDay + currentDay
			weeks = Math.floor(days / 7)
			days %=7
		}
	}


	trace (&quot;age:&quot; + years)
	trace (&quot;months:&quot; + months)
	trace (&quot;weeks:&quot; + weeks)
	trace (&quot;days:&quot; + days)

	//var time:String = years + &quot; years, &quot; + months + &quot; months, &quot; + weeks + &quot; weeks, &quot; + days + &quot; days old&quot; ;

	//time_txt.text = time;
}

function getDays(previousMonth:Number, nowDate:Date):Number{

	var residual:Number = nowDate.getFullYear()%4
	trace(&quot;Is leap =&quot; + residual)

	trace(&quot;previousMonth=&quot; + previousMonth )
	switch(previousMonth){
		case 0://December
			return 31
			break
		case 1://Jaunary
			return 31
			break
		case 2://February
			if (residual == 0){
				return 29
			}else{
				return 28
			}
			break

		case 3://March
			return 31
			break
		case 4://April
			return 30
			break
		case 5://May
			return 31
			break

		case 6://June
			return 30
			break
		case 7://Jul
			return 31
			break
		case 8://Aug
			return 31
			break

		case 9://Sep
			return 30
			break
		case 10://Oct
			return 31
			break
		case 11://Nov
			return 30
			break
	}

	return 0
}

function dateStringToObject(dateString):Date {
    var date_ar = dateString.split(&quot;/&quot;);
    return new Date(date_ar[2],date_ar[0] - 1,date_ar[1]);
}</description>
		<content:encoded><![CDATA[<p>Hi Guys, I am using this in an application we have developed. Just based on initial code. It may need some cleanup and optimization, but wanted to put it in here as a beta version <img src='http://drawlogic.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>var dateNow:Date = new Date();<br />
var checkDate:String = &#8220;12/22/2000&#8243;;<br />
var dateBirthday:Date = dateStringToObject(checkDate);<br />
trace(&#8220;dateNow = &#8220;+dateNow);<br />
trace(&#8220;dateBirthday = &#8220;+dateBirthday);<br />
calculateAge(dateBirthday)</p>
<p>function calculateAge(birthdate:Date):Number {<br />
    var dtNow:Date = new Date();// gets current date<br />
    var currentMonth:Number = dtNow.getMonth() + 1 ;<br />
    var currentDay:Number = dtNow.getDate();<br />
    var currentYear:Number = dtNow.getFullYear();</p>
<p>	var bdMonth:Number = birthdate.getMonth() + 1;<br />
    var bdDay:Number = birthdate.getDate();<br />
    var bdYear:Number = birthdate.getFullYear();</p>
<p>	// get the difference in years<br />
    var years:Number = dtNow.getFullYear() &#8211; birthdate.getFullYear();<br />
    var months:Number<br />
    var weeks:Number<br />
    var days:Number</p>
<p>	// subtract another year if we&#8217;re before the<br />
    // birth day in the current year<br />
    if (currentMonth &lt; bdMonth || (currentMonth == bdMonth &amp;&amp; currentDay  bdMonth){<br />
		months = currentMonth &#8211; bdMonth &#8211; 1</p>
<p>		if(currentDay &gt; bdDay){<br />
			months++<br />
			days = currentDay &#8211; bdDay<br />
			weeks = Math.floor(days / 7)<br />
			days %=7</p>
<p>		}else if(currentDay == bdDay){<br />
			months++<br />
			days = 0;<br />
			weeks = 0<br />
		}else{// currentDay is smaller than bdDay<br />
			// this is not trivial<br />
			// here we calculate the days from the bdDay of the previous month + currentDay<br />
			days =  getDays(currentMonth &#8211; 1, dtNow) &#8211; bdDay + currentDay<br />
			weeks = Math.floor(days / 7)<br />
			days %=7<br />
		}<br />
	}else if(currentMonth == bdMonth){</p>
<p>		if(currentDay &gt; bdDay){<br />
			months = 0<br />
			days = currentDay &#8211; bdDay<br />
			weeks = Math.floor(days / 7)<br />
			days %=7<br />
		}else if(currentDay == bdDay){<br />
			months = 0<br />
			days = 0<br />
			weeks = 0<br />
		}else{// currentDay is smaller than bdDay<br />
			months = 11<br />
			days =  getDays(currentMonth &#8211; 1, dtNow) &#8211; bdDay + currentDay<br />
			weeks = Math.floor(days / 7)<br />
			days %=7<br />
		}<br />
	}else{ // this is when the currentMonth is smaller than bdMonth<br />
		months = (12 &#8211; bdMonth) + (currentMonth &#8211; 1)</p>
<p>		if(currentDay &gt; bdDay){<br />
			months++<br />
			days = currentDay &#8211; bdDay<br />
			weeks = Math.floor(days / 7)<br />
			days %=7<br />
		}else if(currentDay == bdDay){<br />
			months++<br />
			days = 0<br />
			weeks = 0<br />
		}else{// currentDay is smaller than bdDay<br />
			days =  getDays(currentMonth &#8211; 1, dtNow) &#8211; bdDay + currentDay<br />
			weeks = Math.floor(days / 7)<br />
			days %=7<br />
		}<br />
	}</p>
<p>	trace (&#8220;age:&#8221; + years)<br />
	trace (&#8220;months:&#8221; + months)<br />
	trace (&#8220;weeks:&#8221; + weeks)<br />
	trace (&#8220;days:&#8221; + days)</p>
<p>	//var time:String = years + &#8221; years, &#8221; + months + &#8221; months, &#8221; + weeks + &#8221; weeks, &#8221; + days + &#8221; days old&#8221; ;</p>
<p>	//time_txt.text = time;<br />
}</p>
<p>function getDays(previousMonth:Number, nowDate:Date):Number{</p>
<p>	var residual:Number = nowDate.getFullYear()%4<br />
	trace(&#8220;Is leap =&#8221; + residual)</p>
<p>	trace(&#8220;previousMonth=&#8221; + previousMonth )<br />
	switch(previousMonth){<br />
		case 0://December<br />
			return 31<br />
			break<br />
		case 1://Jaunary<br />
			return 31<br />
			break<br />
		case 2://February<br />
			if (residual == 0){<br />
				return 29<br />
			}else{<br />
				return 28<br />
			}<br />
			break</p>
<p>		case 3://March<br />
			return 31<br />
			break<br />
		case 4://April<br />
			return 30<br />
			break<br />
		case 5://May<br />
			return 31<br />
			break</p>
<p>		case 6://June<br />
			return 30<br />
			break<br />
		case 7://Jul<br />
			return 31<br />
			break<br />
		case 8://Aug<br />
			return 31<br />
			break</p>
<p>		case 9://Sep<br />
			return 30<br />
			break<br />
		case 10://Oct<br />
			return 31<br />
			break<br />
		case 11://Nov<br />
			return 30<br />
			break<br />
	}</p>
<p>	return 0<br />
}</p>
<p>function dateStringToObject(dateString):Date {<br />
    var date_ar = dateString.split(&#8220;/&#8221;);<br />
    return new Date(date_ar[2],date_ar[0] &#8211; 1,date_ar[1]);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ormus</title>
		<link>http://drawlogic.com/2008/04/16/howto-using-as3-to-get-age-from-birthday-birthdate/comment-page-1/#comment-755</link>
		<dc:creator>Ormus</dc:creator>
		<pubDate>Thu, 04 Sep 2008 11:41:58 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/?p=188#comment-755</guid>
		<description>*challenge</description>
		<content:encoded><![CDATA[<p>*challenge</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ormus</title>
		<link>http://drawlogic.com/2008/04/16/howto-using-as3-to-get-age-from-birthday-birthdate/comment-page-1/#comment-754</link>
		<dc:creator>Ormus</dc:creator>
		<pubDate>Thu, 04 Sep 2008 11:41:13 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/?p=188#comment-754</guid>
		<description>the chalange it&#039;s to get age like years, months, days. Thx.</description>
		<content:encoded><![CDATA[<p>the chalange it&#8217;s to get age like years, months, days. Thx.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jcip</title>
		<link>http://drawlogic.com/2008/04/16/howto-using-as3-to-get-age-from-birthday-birthdate/comment-page-1/#comment-756</link>
		<dc:creator>jcip</dc:creator>
		<pubDate>Tue, 13 May 2008 18:07:04 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/?p=188#comment-756</guid>
		<description>On lines 4 and 8 you should be using getDate() for the numerical day of the month. getDay() returns the numerical day of the week.

Other than that, thanks!</description>
		<content:encoded><![CDATA[<p>On lines 4 and 8 you should be using getDate() for the numerical day of the month. getDay() returns the numerical day of the week.</p>
<p>Other than that, thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GB</title>
		<link>http://drawlogic.com/2008/04/16/howto-using-as3-to-get-age-from-birthday-birthdate/comment-page-1/#comment-759</link>
		<dc:creator>GB</dc:creator>
		<pubDate>Thu, 17 Apr 2008 07:05:40 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/?p=188#comment-759</guid>
		<description>Bugaga, am/kg :o)
Joseph +1</description>
		<content:encoded><![CDATA[<p>Bugaga, am/kg <img src='http://drawlogic.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> )<br />
Joseph +1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: keita</title>
		<link>http://drawlogic.com/2008/04/16/howto-using-as3-to-get-age-from-birthday-birthdate/comment-page-1/#comment-758</link>
		<dc:creator>keita</dc:creator>
		<pubDate>Thu, 17 Apr 2008 03:27:43 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/?p=188#comment-758</guid>
		<description>How about this?
it&#039;s more accurate.

var bDate:Date = new Date(1978, 3, 28);
var today:Date = new Date();
var age:Date = new Date(today.time - bDate.time);
age.fullYear -= 1970;
trace(age);</description>
		<content:encoded><![CDATA[<p>How about this?<br />
it&#8217;s more accurate.</p>
<p>var bDate:Date = new Date(1978, 3, 28);<br />
var today:Date = new Date();<br />
var age:Date = new Date(today.time &#8211; bDate.time);<br />
age.fullYear -= 1970;<br />
trace(age);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joseph</title>
		<link>http://drawlogic.com/2008/04/16/howto-using-as3-to-get-age-from-birthday-birthdate/comment-page-1/#comment-757</link>
		<dc:creator>Joseph</dc:creator>
		<pubDate>Wed, 16 Apr 2008 22:44:40 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/?p=188#comment-757</guid>
		<description>Here&#039;s a simpler version...

function calculateAge(birthdate:Date):int {
   return Math.floor(  ((new Date()).getTime()-birthdate.getTime())/31536000000  );
}

OK, maybe not as leap year friendly, but it works.</description>
		<content:encoded><![CDATA[<p>Here&#8217;s a simpler version&#8230;</p>
<p>function calculateAge(birthdate:Date):int {<br />
   return Math.floor(  ((new Date()).getTime()-birthdate.getTime())/31536000000  );<br />
}</p>
<p>OK, maybe not as leap year friendly, but it works.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

