cp100
cp100

Reputation: 1493

Get entered time from RadTimePicker c#

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

Answers (3)

codingbiz
codingbiz

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

proven&#231;al le breton
proven&#231;al le breton

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

Zaki
Zaki

Reputation: 5600

try this:

 DateTime dt = RadTimePicker1.SelectedDate.Value;  
 string time = dt.ToShortTimeString().ToString(); 

Upvotes: 0

Related Questions