How to use the datetime picker or month calender control in C# Windows Application?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Subir Nath
    New Member
    • Dec 2010
    • 1

    How to use the datetime picker or month calender control in C# Windows Application?

    Sir,
    I am working on my academic project in C# windows application for management of an institute.
    Am not able to use the 'month calender' or 'datetime picker' control.
    I need to select a date using any of the above controls and based on the selected date I need to add some few more days to that and get the final date. I also need to store all those dates in the database(SQL Server 2005)so that I can later retrive it and check for any free dates available.
    I am facing problem in storing the date as the time also gets stored along with the dates and later on creates a problem while retreiving it and checking. I need only to store the date.
    Please suggest me a solution to my problem and also which control(datetim e picker or month calender will be apt.)
    Thanking You.
  • Fr33dan
    New Member
    • Oct 2008
    • 57

    #2
    The DateTimePicker and MonthCalander class both return DateTime object so you can decide which one fits your application best.

    If you use MonthCalendar it should be noted that it allows you to select a range you probably want to use the SelectionStart property to get the date (It's the Value property on the DateTimePicker) .

    DateTime has functions for adding days/other time increments to find your desired date.

    As for your other issues I'm not too familiar with SQL but maybe one of DateTime's formatted toString's would help (like ToShortDateStri ng)?

    Comment

    Working...