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

How to format results returned FROM TimePicker control for JQuery

3 Answers 59 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Rob Gaudet
Top achievements
Rank 1
Rob Gaudet asked on 30 Oct 2012, 09:32 PM
Is there a way to format the results returned from the TimePicker control? This is what I'm currently getting 2012-10-30-22-00-00 when I reference the control via a jquery call, such as below.


var time = $("#<%=radTimePicker.ClientID%>").val();

3 Answers, 1 is accepted

Sort by
0
Accepted
Vasil
Telerik team
answered on 31 Oct 2012, 07:18 AM
Hello Rob,

You can find the client side object of the DatePicker or its Dateinput and use get_selectedDate property. It will return a Date object. See the flowing resources:
http://www.telerik.com/help/aspnet-ajax/input-client-side-basics.html
http://www.telerik.com/help/aspnet-ajax/calendar-client-side-basics.html
http://www.telerik.com/help/aspnet-ajax/calendar-client-side-rad-timepicker.html

Kind regards,
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.
0
Princy
Top achievements
Rank 2
answered on 31 Oct 2012, 07:58 AM
Hi,

Try the following code to achieve your scenario.

JS:
<script type="text/javascript">
 function OnClientClicked()
 {
  var test = $("#<%=RadTimePicker1.ClientID%>").val().split('-');
  var temp = test[3] + ':' + test[4] + ':' + test[5];
  alert(temp);
 }
</script>

Hope this helps.

Thanks,
Princy.
0
Rob Gaudet
Top achievements
Rank 1
answered on 31 Oct 2012, 09:50 PM
This worked really well. I was pleased that I didn't have to add references to any other assemblies or script files, it just worked. Cool.
Tags
Calendar
Asked by
Rob Gaudet
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Princy
Top achievements
Rank 2
Rob Gaudet
Top achievements
Rank 1
Share this question
or