Reputation: 1493
I have Telerik RadTimePicker in my aspx page. In code behind, I need to get the time from this RadTimePicker control.
<telerik:RadTimePicker ID="radTimeStartTime" runat="server" ZIndex="30001"> </telerik:RadTimePicker>
Upvotes: 2
Views: 6322
Reputation: 26386
You should be able to get it with "HH:mm:ss" - hour:minutes:seconds
DateTime d = radTimeStartTime.SelectedDate.Value;
string time = d.ToString("HH:mm:ss");
Upvotes: 4
Reputation: 1438
Give a name to your RadTimePicker and then :
DateTime myDate = RadTimePickerName.SelectedDate.Value;
And myDate to string :
string myString = myDate .ToShortTimeString().ToString();
You can also do it in one line, if you just use the string :
string myString = RadTimePickerName.SelectedDate.Value.ToShortTimeString().ToString();
Upvotes: 1
Reputation: 5600
try this:
DateTime dt = RadTimePicker1.SelectedDate.Value;
string time = dt.ToShortTimeString().ToString();
Upvotes: 0