How to format results returned FROM TimePicker control for JQuery

4 posts, 1 answers
  1. Rob Gaudet
    Rob Gaudet avatar
    5 posts
    Member since:
    Nov 2005

    Posted 30 Oct 2012 Link to this post

    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();
  2. Answer
    Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 31 Oct 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 31 Oct 2012 Link to this post

    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.
  5. Rob Gaudet
    Rob Gaudet avatar
    5 posts
    Member since:
    Nov 2005

    Posted 31 Oct 2012 Link to this post

    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.
Back to Top