Why does RadDatePicker.SelectedDate include the time?

6 posts, 1 answers
  1. Casey
    Casey avatar
    299 posts
    Member since:
    Jul 2009

    Posted 04 Nov 2009 Link to this post

    Hello,

    Why does RadDatePicker.SelectedDate include the time? If the time needs to be included in the SelectedDate value, then why not just use a RadDateTimePicker? Please help me to understand the logic behind including the time on the SelectedDate.

    Thanks,
    Casey
  2. Martin
    Admin
    Martin avatar
    811 posts

    Posted 06 Nov 2009 Link to this post

    Hello Casey,

    The SelectedDate property of the RadDatePicker control uses a value of type DateTime. To extract the Date component of it you can check the following MSDN article:

    DateTime.Date Property 

    You can also get the string representation of the date using the ToShortDateString Method.

    Let us know if you need further assistance

    Best regards,
    Martin
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Casey
    Casey avatar
    299 posts
    Member since:
    Jul 2009

    Posted 06 Nov 2009 Link to this post

    Thanks Martin. The issue I was having was when using the RadDatePicker as a filter inside a RadGrid. The filter would be for 11/6/2009 12:00:00 AM, instead of just for 11/6/2009. I ended up removing the filtering option from inside the RadGrid and there are two RadDatePickers outside of the RadGrid where the user can select a range of date to view all requests between the dates they select. I'm not sure if I'm the only person that would like this feature, but I think that there should be an option added to the RadDatePicker to use a certain date format for the selected date.
     
    Thanks,
    Casey
  5. Answer
    Martin
    Admin
    Martin avatar
    811 posts

    Posted 10 Nov 2009 Link to this post

    Hello Casey,

    Thank you for your suggestion.I am afraid the required functionality does not depend on raddatepicker only but also on the framework itself. Since there is no suitable type to use the picker control uses the DateTime object as it is the most appropriate available option.

    You can also check the following forum thread for a discussion on a same topic:

    Date Time Col Doesnt Find Date in Timestamp


    I hope this helps
    Martin
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Alexander
    Alexander avatar
    152 posts
    Member since:
    Jun 2012

    Posted 02 Nov 2012 Link to this post

    I also bumped into the problem with time part shown in RadDatePicker :(

    I have radiobutton which makes postback without response redirect.

    So, when I come to the page containing RadDatePicker on such PostBack, without setting initial value on non-postback loading, I get time part shown. I tried to fight it, but in vain.

    So I need to invent some dirty hack to cut time part. I see no other way around, I need postback.

    The most sad thing is that sometimes I am able to reproduce this stuff and sometimes it's suddenly getting ok without any code changes!
    And one more: the same filter sometimes displays time in american style (AM/PM), sometimes in european - also no some special settings...

    UPDATE: I had to force TimeFormat to string.Empty for one page and to "HH:mm" (I use such format everywhere) for others in PreRender event (Mr. Dirty Hack)
  7. Martin
    Admin
    Martin avatar
    811 posts

    Posted 06 Nov 2012 Link to this post

    Hello Alexander,

    I am not quite sure that you are observing the same problem this thread was opened for. I would suggest that you open a formal support ticket and send a sample project demonstrating the issues you have hit. This way we will be able to provide more to the point resolution.

    Kind regards,
    Martin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017