TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Administrator
Tech Writer
2.2k
1.5m
C# syntax from VB: Datediff("yyyy",sDoB,date()) ?
Mar 6 2003 7:27 PM
Hi, I would like to calculate the age of a person given his/her birthdate. I'm doing this in C# and I had a really hard time finding the similar function like how VBScript used to do: Datediff("yyyy",sDoB,date()) when "yyyy" will give you the number of years. In my code: DateTime date1 = new DateTime(1972,1,1); //let's say the person's birthdate is 1/1/1972 TimeSpan TimeAlive = DateTime.Now - date1; Response.Write (TimeAlive); So I want to calculate how old he/she is from today's date. But so far I can only get the number of days. Is there another way? Thank so much!
Reply
Answers (
2
)
Printing Windows Tabpages in C#.
Novice Question - Generic Class Writing and Reading Files