hi guys, i have a textbox that displays date in format,for eg:March,20,2008.Then i need to get total days n march in year 2008.Can anybody help
+3
A:
int year = DateTime.Now.Year;
int month = DateTime.Now.Month;
int numDays = DateTime.DaysInMonth(year, month);
Rashack
2009-03-31 08:32:08
beat by 2 seconds!
John Nolan
2009-03-31 08:33:13
A:
Use DataTime.DaysInMonth()
http://msdn.microsoft.com/en-us/library/system.datetime.daysinmonth(VS.71).aspx
John Nolan
2009-03-31 08:32:10
+5
A:
You can use the DaysInMonth function
e.g.
Date.DaysInMonth(2008, 3)
Obviously, you'll have to pass the year and month to the function
kevchadders
2009-03-31 08:35:07
A:
Remember to use the date they entered. VB Code:
dim enteredDate as DateTime = cdate(txtDateBox.text)
dim daysInMonth as Int = DateTime.DaysInMonth(enteredDate.year,enteredDate.month)
Damien
2009-03-31 08:39:37