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
Jump to Post
Lets 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;
All 6 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.