Hi guys I'm a newbie of JavaScript and I tried a lot before posting here.
I have two input tags where i'm using Datapicker from jquery UI to pick some data range.
After I select these values with jQuery method .val(), but the problem is that Datepicker use this type of data form: 12/30/2013, but I need to parse this data in this way: 2013-10-21T00:00:00 because I must use this date range to call a getJSON method to call a webserver. I wrote also this function to parse manually. Bellow is my code, what's wrong? In general I want to find a way to translate the data from input tags in this format: yyyy-MM-dd'T'HH:mm:ss because our web server accept through rest this format.
<input id="from" type="text" class="datepicker" />
<input id="to" type="text" class="datepicker" />
<input id="submit" value="Send" type="submit" />
<script>      
$(function () {
        $(".datepicker").datepicker();
    });
    $("#submit").click(function () {
        var from = $('#from').val();
        var to = $('#to').val();
        function parse(i) {
            var t = i.toString().split("/");
            var y = t[2];
            var m = t[0];
            var d = t[1];
            var n_d = y.concat("-") + m.concat("-") + d.concat("T00:00:00");
            return n_d;
        }
    $.getJSON("xxxx/?from=" + parse(from) + "&to=" +parse(to));
    });
</script>
 
     
    