Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi all,
I have two textboxes,one is calendar extendar and another one is normaltext box.I want to calculate calendarextender date to current date .I want output as a date.
Please advice me.

Thanks & Regards
Hari
Posted

Try, in one line,
C#
int age = new DateTime(DateTime.Now.Subtract(extenderDate).Ticks).Year-1;
 
Share this answer
 
v2
Comments
Hari Krishna Prasad Inakoti 3-Feb-13 13:24pm    
@Abhinav itz not working.
Abhinav S 3-Feb-13 23:27pm    
Are you getting an error?
Hari Krishna Prasad Inakoti 4-Feb-13 0:37am    
yes
Hi,
I am a little confused you need output as Date? for example if extender date is date of birth and text box date istodays date, we can calculate the difference in years, months or days, However output as date I am bit lost here. Can you please brief your requirement.

Cheers
BS.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900