Hey guys,
Im using asp.net in visual studio and im kinda new to the whole thing.
Im actually making a multi view form, and in the second view i need to calculate a persons age based on the date of birth that has been typed in view 1.Anyone know how to?I thnk its through regular expressions but we havent really been taught how to do that:S
Roses89
0
Junior Poster in Training
Recommended Answers
Jump to PostLets say that your DOB is being display by a textbox id = "txtDOB" then you can do this.
int years = DateTime.Today.Year - Convert.ToDateTime(txtDOB.Text).Year;
Jump to PostWhat control do you want to render the age in?
All 6 Replies
jbisono
51
Posting Pro in Training
Roses89
0
Junior Poster in Training
jbisono
51
Posting Pro in Training
Lusiphur
185
Practically a Posting Shark
Team Colleague
Featured Poster
jbisono
51
Posting Pro in Training
virusisfound
0
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.