3 Answers, 1 is accepted
Please try the following code snippet to achieve your scenario.
ASPX:
<
telerik:RadDateTimePicker
ID
=
"RadDateTimePicker2"
runat
=
"server"
Culture
=
"English (United States)"
>
<
TimeView
TimeFormat
=
"HH:mm:ss.fff"
runat
=
"server"
>
</
TimeView
>
<
DateInput
DisplayDateFormat
=
"yyyy-MM-dd HH:mm:ss.fff"
runat
=
"server"
>
</
DateInput
>
</
telerik:RadDateTimePicker
>
Thanks,
Shinu.
Hi Shinu,
I have issue with adding minutes.
After I set "12/2/2023 3:00" to RadDateTimePicker - I want to add 5 minutes in order to get "12/2/2023 3:05"
But data is not changing.
This is my code :
DateTime date = {12/2/2023 3:00 PM} ( it was set to RadDateTimePicker )
string SelectedDate = date.ToString("yyyy-MM-dd");
string SelectedTime = date.ToString("HH:mm");
double minutes = Convert.ToDouble(RadDropDownList.SelectedText);
date.AddMinutes(minutes); <- this statement does not add 5 minutes: The date remains as "12/2/2023 3:00"
Please help.
Regards, Anatoly
Hi Anatoly,
I already replied to your support ticket regarding this issue, but I will also share the message in this forum thread:
I've tried increasing the Current selected Date by 5 minutes and it is working as expected.
if (RadDateTimePicker1.SelectedDate != null)
{
RadDateTimePicker1.SelectedDate = RadDateTimePicker1.SelectedDate.Value.AddMinutes(5);
}
If this does not work for you, there might be other reasons for that.
If you have AJAX enabled either by using (AjaxManager, AjaxPanel, or asp:UpdatePanel), remove them temporarily and test the application again. This will prevent the AJAX from hiding the server exceptions and show the exception in detail if those are generated.
To be able to tell you more, we would need to see the complete implementation of the DateTimePicker as well as share with us the code that changes the date (including the function name). We need to understand which event of the Page's LifeCycle Event is being used for that.
not working for me, see picture, pls help, thanks:
<telerik:RadDateTimePicker ID="RadDateTimePicker2" runat="server" Culture="English (United States)">
<TimeView TimeFormat="HH:mm:ss.fff" runat="server">
</TimeView>
<DateInput DisplayDateFormat="yyyy-MM-dd HH:mm:ss.fff" runat="server">
</DateInput>
</telerik:RadDateTimePicker>
Hi,
Telerik RadDatePicker uses RadCalendar underneath and that has its own formatting pattern, see Date Format Patterns. That is the reason the The "fff" custom format specifier did not apply in your case.
For more information on Formatting the Date in the Calendar, please check out the following articles:
Kind regards,
Doncho
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.