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

DateTime Picker TimeView (times from yesterday showing as today)

1 Answer 119 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 05 Oct 2011, 08:02 PM
Hi,
 For the DateTimePicker, I set the TimeView.StartTime and TimeView.EndTime in the code behind.
 When the Time selection is actually a time from yesterday, upon selection, today's date is put in the TextBox.

So if the time 23:30 is in the TimeView and 23:30 is actually 23:30 on 10/04 (and today is 10/05).
Upon selection it shows as 10/05/11 23:30 instead of 10/04/2011 23:30.
In debug mode, when i check the value of the StartTime and EndTime they are clearly separate days, but it doesn't carry over to the front-end functionality.

Does RadDateTimePicker support days that aren't today???


int
nStartMinute = now.Minute / 15 * 15;
 radFaultDateTime.TimeView.StartTime = new TimeSpan(now.Subtract(new TimeSpan(14, 0, 0)).DayOfYear, now.Subtract(new TimeSpan(14, 0, 0)).Hour, nStartMinute, 0);
 radFaultDateTime.TimeView.EndTime = new TimeSpan(now.Add(new TimeSpan(2, 0, 0)).DayOfYear, now.Add(new TimeSpan(2, 0, 0)).Hour, nStartMinute, 0);
                radFaultDateTime.TimeView.Interval = new TimeSpan(1, 0, 0);
                radFaultDateTime.ShowPopupOnFocus = true;

Thanks,

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 10 Oct 2011, 01:40 PM
Hi Patrick,

With RadTimePicker you could pick only the time, and the date will be the current date.
And if you want to pick the Date and the Time, then use RadDateTimePicker. If you set Start time and End time, you would be still be able to select different dates. For example if you use the code-below, you could select 8/17/2011 4:00 PM even that today is not 10/10/2011.
Aspx:
<telerik:RadDateTimePicker ID="RadDateTimePicker1" runat="server">
  <TimeView StartTime="15:00" EndTime="18:00">
  </TimeView>
</telerik:RadDateTimePicker>

Greetings,
Vasil
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
General Discussions
Asked by
Patrick
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or