Can anyone please let me know how can I get the difference between two dates?
Is there any function in c#?

I've one more question can I check for value of the textbox like if value should be atleast 500 or more??

I want to use custom validators in c#.

Recommended Answers

All 4 Replies

Thanks Pritaeas..

Actuallly I want to calculate the age..

I think that's what pritaeas is saying. You use DateTime and you can subtract them (return TimeSpan object).

        DateTime dob = new DateTime(1980, 7, 1);
        TimeSpan difference = DateTime.Now - dob;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.