Problems Obtaining Date from Java

2 posts, 0 answers
  1. Ron
    Ron avatar
    86 posts
    Member since:
    Sep 2009

    Posted 04 Dec 2012 Link to this post


    I am simply trying to obtain the date selected from the RadDatePicker control through javascript as I am trying to pass the value to another page as a parameter for an SQL query the page performs when loading.  However, I am having a problem with the format the date is returing.  I have tried both get_selectedDates and get_textBox with no luck in returning a date that is in a datetime format for the parameter.  With get_seletedDates I am getting a long formatted style not in the correct format while get_textBox doesn't return a date value, only that it is an HTMLelement or something along that lines.

    Is there a way to get the date that is in the text box portion of the datepicker to return how it actually shows in the date picket, for instance 12/10/2012?

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Dec 2012 Link to this post

    Hi Ron,

    You can format the selecteddate to achieve your scenario. Following is the sample code that I tried to achieve your scenario.

    <telerik:RadDatePicker ID="RadDatePicker1" runat="server">
    <asp:Button ID="Button1" runat="server" OnClientClick="OnClientClick(); return false;" />

    <script type="text/javascript">
        function OnClientClick() {
            var datepicker = $find("<%= RadDatePicker1.ClientID %>");
            var date = datepicker.get_selectedDate();
            var day = date.format("MM/dd/yyyy");

    Hope this helps.

  3. DevCraft R3 2016 release webinar banner
Back to Top