Click here to Skip to main content
15,666,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a two Month Calendar and I want to count the day's for example I choose a date from month Calendar1 I choose March 16 2015 and from month calendar2 I choose March 19 2015 I want to count the day's and put the answer on the textBox.Text which is 4.
Posted
Updated 15-Mar-15 4:04am
v4
Comments
Afzaal Ahmad Zeeshan 15-Mar-15 10:05am    
Please do not use terms like asap in questions. We do not hurry or rush to answer here... I have edited your post, keep these in mind.

See the DateTime.Subtract[^] method.
 
Share this answer
 
Comments
Maciej Los 15-Mar-15 10:40am    
+5
CPallini 15-Mar-15 10:56am    
Thank you.
TheRealSteveJudge 16-Mar-15 4:28am    
Exactly! 5*
Try this-
C#
DateTime dateFirst=Calendar1.SelectedDate;
DateTime dateSecond=Calendar2.SelectedDate;
int resultDays= (dateSecond-dateFirst).Days;


Hope, it helps :)
 
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