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

3

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.