I have to set the date in my datepicker in dd/mm/yyyy format. Whet I'm trying to do, with Javascript is this:
var year = 2014;
var month = 5;
var day = 10;
var realDate = new Date(year, month - 1, day); // months are 0-based!
$('#MainContent_txtDataConsegna').datepicker({ dateFormat: 'dd/mm/yyyy' }); // format to show
$('#MainContent_txtDataConsegna').datepicker('setDate', realDate);
the problem is that the value inside my datepicker is always in format mm/dd/yyyy. Where is the problem??
Here the definition datepicker and datepicker options:
<div class="input-group date">
<asp:TextBox runat="server" ID="txtDataOrdine" class="form-control" onBlur="CalcolaTotaliTestata('txtDataOrdine')"></asp:TextBox>
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i>/span>
</div>
<script type="text/javascript">
$('.input-group.date').datepicker({
todayBtn: "linked",
language: "it",
autoclose: true,
todayHighlight: true,
dateFormat: 'dd/mm/yyyy'
});
</script>
dateFormat: 'dd/mm/yy'
, and for pure javascript useformat: 'dd/mm/yyyy'
– Younglove