Reputation: 9
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
Upvotes: 0
Views: 1819
Reputation: 21
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
Upvotes: 2