This is a migrated thread and some comments may be shown as answers.

Why does RadDatePicker.SelectedDate include the time?

5 Answers 339 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Casey
Top achievements
Rank 1
Casey asked on 04 Nov 2009, 07:07 PM
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

5 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 06 Nov 2009, 01:05 PM
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.
0
Casey
Top achievements
Rank 1
answered on 06 Nov 2009, 01:15 PM
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
0
Accepted
Martin
Telerik team
answered on 10 Nov 2009, 03:22 PM
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.
0
Alexander
Top achievements
Rank 1
answered on 02 Nov 2012, 03:10 PM
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)
0
Martin
Telerik team
answered on 06 Nov 2012, 04:16 PM
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.
Tags
Calendar
Asked by
Casey
Top achievements
Rank 1
Answers by
Martin
Telerik team
Casey
Top achievements
Rank 1
Alexander
Top achievements
Rank 1
Share this question
or