Hi everybody, Can some body tell me how can i find that which date (day,month and year) is selected in calender(I already have dropped calender on form) by pressing a button. Which code Should i wrote to find the date?
Thanks
Zeb-ur-Rehman
Loading
VulpesPosted Apr 28, 2011, 6:04 AM
If you also have a namespace called DateTime then, as Shrikant said, I'd change it to something else. Otherwise, whenever you use the DateTime type, you'll always have to qualify it as: System.DateTime.
Soft CornerPosted Apr 28, 2011, 3:37 AM
I guess your application name is "DateTime", if that so , then you need to Change it , bcz it will create ambiguity between namespace & datatype.
Ankit NandekarPosted Apr 28, 2011, 3:27 AM
Zeb RehmanPosted Apr 28, 2011, 3:18 AM
Here it show me that DateTime is namespace but used as type.
Soft CornerPosted Apr 28, 2011, 1:39 AM
you need to convert it into DateTime and then store it in DB table , for e.g :
DateTime dt = Convert.ToDateTime(dateTimePicker1.Value.ToString("d MMMM yyyy"));
Zeb RehmanPosted Apr 28, 2011, 1:13 AM
VulpesPosted Apr 27, 2011, 4:45 PM
If you are, then you can show the currently selected date with code such as the following:
Zeb RehmanPosted Apr 27, 2011, 3:17 PM
Jean PaulPosted Apr 27, 2011, 1:57 PM
From your query I am not sure whether you are using ASP.NET / WinForms.
If you are using ASP.NET, Calendar1.SelectedDate should give the selected date.
There is a collection of dates property named SelectedDates for giving multiple date selections.
If you are using Windows Forms and MonthCalendar control, you have to use the control.SeletionStart and control.SelectionEnd datetime properties
(I believe this control is to specify a range of date by selecting the start and end dates)
Regards,
Jean Paul