0

I am using a TextBox control for calendar where user can select date from calendar,.aspx code is as below

<asp:TextBox ID="txtPaymentDate" runat="server"></asp:TextBox>
    <script>
        window.onload = function () {
            $("#<%=txtPaymentDate.ClientID%>").datepicker({
            autoclose: true
        });              
    }
    </script>

This gives me date in MM/DD/YYYY fromat, example: 09/20/2017

I want the date in DD/MM/YYYY format, trying to get the same but failed.Pl provide me the syntax to get the DD/MM/YYYY date format

Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939

1 Answers1

2

You can add dateFormat option:

<asp:TextBox ID="txtPaymentDate" runat="server"></asp:TextBox>
<script>
    window.onload = function () {
        $("#<%=txtPaymentDate.ClientID%>").datepicker({
        autoclose: true,
        dateFormat: "dd/mm/yy"
    });              
}
</script>

Reference: http://api.jqueryui.com/datepicker/#option-dateFormat

zzmail
  • 21
  • 1
  • 3