0

I am using the following code in program to create a To and From date i want to change my date format displayed(present format:mm/dd/yyyy to my requirement:dd/mm/yyyy)

<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>

<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>


jQuery(function(){
    jQuery('#startDate').datepicker({
        beforeShow : function(){
            jQuery( this ).datepicker('option','maxDate', jQuery('#endDate').val() );
        }
    });
    jQuery('#endDate').datepicker({
        beforeShow : function(){
            jQuery( this ).datepicker('option','minDate', jQuery('#startDate').val() );
        }
    });
})
  </script>
  </head>
  <body>

  <p>From Date: <input type="text" id="startDate"> To Date: <input type="text" id="endDate" onchange=""></p>


 </body>
 </html>

Thanks in Adv!

VSVR
  • 1
  • 2
  • @Richard Dalton i want to know how to add that scriplet in my code cause tried everything i could but its not working, either it shows the default date format or i cannot choose the date itself.so please remove the marked as duplicate – VSVR Jun 05 '14 at 04:38

1 Answers1

0

You can use dateFormat: "dd/mm/yy" inside your .datepicker()

so something like

.datepicker({
    dateFormat: "dd/mm/yy"
})
Andy Holmes
  • 7,817
  • 10
  • 50
  • 83