--_c8ad2b35-74cf-4fd0-8ff8-dee92537b468_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable


> When I do this:
> 
> dob="05/01/1968"
> x=Date.parse(dob)
> x.month
> 
> I get 1 instead of 5.
> How do I do this?
> 

Well, it's not a bug or something. The rest of the world uses day/month/year so that is the default that the Date.parse method uses.

The easiest solution (and the best way to do this IMO) is to just feed the method "01/05/1968" instead of "05/01/1968".

If for some reason, you HAVE to have the m/d/y format, you could just use a regexp. Could be something like this, but note, it's not really the best regexp, just something I came up with now (you can use rubular.como figure out ruby regexps easily):

dob = "05/01/1968"
dob =~([01]\d)\/([0-3]\d)\/((19|20)\d\d) 		 	   		  
_________________________________________________________________
Bing brings you maps, menus, and reviews organized in one place.   Try it now.
http://www.bing.com/search?q=restaurants&form=MLOGEN&publ=WLHMTAG&crea=TEXT_MLOGEN_Core_tagline_local_1x1-_c8ad2b35-74cf-4fd0-8ff8-dee92537b468_--