<?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: How to validate Date of Birth with jQuery</title>
	<atom:link href="http://dev-tips.com/featured/how-to-validate-date-of-birth-with-jquery/feed" rel="self" type="application/rss+xml" />
	<link>http://dev-tips.com/featured/how-to-validate-date-of-birth-with-jquery</link>
	<description>Become a Better Developer, One Tip at a Time.</description>
	<lastBuildDate>Tue, 27 Sep 2011 18:42:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: charlie</title>
		<link>http://dev-tips.com/featured/how-to-validate-date-of-birth-with-jquery#comment-2043</link>
		<dc:creator>charlie</dc:creator>
		<pubDate>Thu, 18 Aug 2011 09:09:34 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=261#comment-2043</guid>
		<description>Thats great, but i have two problems, 
1. What happens if my birthday is a leap year
2. How did you get it so it would on let you select 31st of august etc. and then the next month onle has 28 days in it, seems like you would have to hack this out no?</description>
		<content:encoded><![CDATA[<p>Thats great, but i have two problems,<br />
1. What happens if my birthday is a leap year<br />
2. How did you get it so it would on let you select 31st of august etc. and then the next month onle has 28 days in it, seems like you would have to hack this out no?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prakash</title>
		<link>http://dev-tips.com/featured/how-to-validate-date-of-birth-with-jquery#comment-2006</link>
		<dc:creator>prakash</dc:creator>
		<pubDate>Thu, 12 May 2011 11:24:34 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=261#comment-2006</guid>
		<description>this code is not working,i think i have some problem in my coding. i got error</description>
		<content:encoded><![CDATA[<p>this code is not working,i think i have some problem in my coding. i got error</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eglise</title>
		<link>http://dev-tips.com/featured/how-to-validate-date-of-birth-with-jquery#comment-2005</link>
		<dc:creator>Eglise</dc:creator>
		<pubDate>Mon, 09 May 2011 12:51:42 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=261#comment-2005</guid>
		<description>thanks for this tip ;-)</description>
		<content:encoded><![CDATA[<p>thanks for this tip <img src='http://dev-tips.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anna</title>
		<link>http://dev-tips.com/featured/how-to-validate-date-of-birth-with-jquery#comment-1768</link>
		<dc:creator>Anna</dc:creator>
		<pubDate>Sun, 02 May 2010 13:37:17 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=261#comment-1768</guid>
		<description>Hi I&#039;ve been trying to validate and post a birth date into my db but no sucess. Can someone help me please. I can post the values except the date of birth that is not recognized as it is posted in this format: DD MM YYYY. So i need to convert it into US format to be accepted by mysql. I have tried explode () but was not able to make it work


Here is my code:



THANKS A LOT
Anna</description>
		<content:encoded><![CDATA[<p>Hi I&#8217;ve been trying to validate and post a birth date into my db but no sucess. Can someone help me please. I can post the values except the date of birth that is not recognized as it is posted in this format: DD MM YYYY. So i need to convert it into US format to be accepted by mysql. I have tried explode () but was not able to make it work</p>
<p>Here is my code:</p>
<p>THANKS A LOT<br />
Anna</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cormac</title>
		<link>http://dev-tips.com/featured/how-to-validate-date-of-birth-with-jquery#comment-868</link>
		<dc:creator>Cormac</dc:creator>
		<pubDate>Tue, 04 Aug 2009 21:12:41 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=261#comment-868</guid>
		<description>Hi, thanks for the great tip. I&#039;ve used it to create an LDA form on a site i&#039;m working on and it works great. 

I&#039;ve been trying to add a function to create a cookie with the age when the form is submitted, so it can be checked throughout the site, but haven&#039;t been able to get it working so far - If anyone has any advice i&#039;d love to hear it!

Cheers</description>
		<content:encoded><![CDATA[<p>Hi, thanks for the great tip. I&#8217;ve used it to create an LDA form on a site i&#8217;m working on and it works great. </p>
<p>I&#8217;ve been trying to add a function to create a cookie with the age when the form is submitted, so it can be checked throughout the site, but haven&#8217;t been able to get it working so far &#8211; If anyone has any advice i&#8217;d love to hear it!</p>
<p>Cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Corey</title>
		<link>http://dev-tips.com/featured/how-to-validate-date-of-birth-with-jquery#comment-833</link>
		<dc:creator>Corey</dc:creator>
		<pubDate>Thu, 09 Jul 2009 19:27:12 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=261#comment-833</guid>
		<description>cut out my code...

&lt;code&gt;
function validate_date($separator, $date) {
	list($m, $d, $y) = explode($separator, $date);
	
	$dateCheck = checkdate($m, $d, $y);
	if($dateCheck == 1) {	// date is valid!
		//setup your return variable
	}
}	


// $date is in month, day, year format
$date 	   = &#039;2/19/1984&#039;;
$separator = &#039;/&#039;;
$checkDate = validate_date($separator, $date);
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>cut out my code&#8230;</p>
<p><code><br />
function validate_date($separator, $date) {<br />
	list($m, $d, $y) = explode($separator, $date);</p>
<p>	$dateCheck = checkdate($m, $d, $y);<br />
	if($dateCheck == 1) {	// date is valid!<br />
		//setup your return variable<br />
	}<br />
}	</p>
<p>// $date is in month, day, year format<br />
$date 	   = '2/19/1984';<br />
$separator = '/';<br />
$checkDate = validate_date($separator, $date);<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Corey</title>
		<link>http://dev-tips.com/featured/how-to-validate-date-of-birth-with-jquery#comment-832</link>
		<dc:creator>Corey</dc:creator>
		<pubDate>Thu, 09 Jul 2009 19:26:22 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=261#comment-832</guid>
		<description>I did a similar project as well, just validating the date is valid. Here is what I put together.

&lt;code&gt;

&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I did a similar project as well, just validating the date is valid. Here is what I put together.</p>
<p><code></p>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carlton Dickson</title>
		<link>http://dev-tips.com/featured/how-to-validate-date-of-birth-with-jquery#comment-508</link>
		<dc:creator>Carlton Dickson</dc:creator>
		<pubDate>Mon, 30 Mar 2009 08:58:07 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=261#comment-508</guid>
		<description>Thanks a lot for this one, I used this within the jQuery validation library as a custom method...could probably do with a tidy up but it works :)

&lt;code&gt;
$.validator.addMethod(&#039;check_date_of_birth&#039;, function(value, element) {
	var day = $(&quot;#date_of_birth_day&quot;).val();
	var month = $(&quot;#date_of_birth_month&quot;).val();
	var year = $(&quot;#date_of_birth_year&quot;).val();
	var age = $.cookie(&#039;gwLegalAge&#039;) &#124;&#124; 21;

	var mydate = new Date();
	mydate.setFullYear(year, month-1, day);

	var currdate = new Date();
	currdate.setFullYear(currdate.getFullYear() - age);
	
	return (currdate - mydate &lt; 0 ? false : true); 
});
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Thanks a lot for this one, I used this within the jQuery validation library as a custom method&#8230;could probably do with a tidy up but it works <img src='http://dev-tips.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><code><br />
$.validator.addMethod('check_date_of_birth', function(value, element) {<br />
	var day = $("#date_of_birth_day").val();<br />
	var month = $("#date_of_birth_month").val();<br />
	var year = $("#date_of_birth_year").val();<br />
	var age = $.cookie('gwLegalAge') || 21;</p>
<p>	var mydate = new Date();<br />
	mydate.setFullYear(year, month-1, day);</p>
<p>	var currdate = new Date();<br />
	currdate.setFullYear(currdate.getFullYear() - age);</p>
<p>	return (currdate - mydate &lt; 0 ? false : true);<br />
});<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Meshach</title>
		<link>http://dev-tips.com/featured/how-to-validate-date-of-birth-with-jquery#comment-405</link>
		<dc:creator>Meshach</dc:creator>
		<pubDate>Tue, 10 Mar 2009 19:34:50 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=261#comment-405</guid>
		<description>Awesome!!!!</description>
		<content:encoded><![CDATA[<p>Awesome!!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry Roodt</title>
		<link>http://dev-tips.com/featured/how-to-validate-date-of-birth-with-jquery#comment-398</link>
		<dc:creator>Barry Roodt</dc:creator>
		<pubDate>Tue, 10 Mar 2009 05:24:23 +0000</pubDate>
		<guid isPermaLink="false">http://dev-tips.com/?p=261#comment-398</guid>
		<description>Hi Yoosuf,

Thanks for the comment. Using server-side validation would be critical yes, hence the use of a form.

Perhaps my next tip would be the back-end version of this script - thanks for the idea :)</description>
		<content:encoded><![CDATA[<p>Hi Yoosuf,</p>
<p>Thanks for the comment. Using server-side validation would be critical yes, hence the use of a form.</p>
<p>Perhaps my next tip would be the back-end version of this script &#8211; thanks for the idea <img src='http://dev-tips.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

