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!

1
  • @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 Commented Jun 5, 2014 at 4:38

1 Answer 1

0

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

so something like

.datepicker({
    dateFormat: "dd/mm/yy"
})
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.