jQuery UI DatePicker - 更改日期格式 - Datepicker

时间:2021-12-31 20:36:28

I want to format my date in dd/mm/yy. This is my code, it doesn't work:

我想用dd / mm / yy格式化我的日期。这是我的代码,它不起作用:

var lStartDate = $('#datepicker').datepicker({ dateFormat: 'dd/mm/yy' }).val();

 alert(lStartDate)

Now I receive alert with "06/29/2017"

现在我收到警告“06/29/2017”

3 个解决方案

#1


0  

Try out

$('#datepicker').datepicker({ dateFormat: 'dd-mm-yy' }).val();

#2


0  

<input type=text  data-date-format='dd/mm/yy' class="form-control" required> 

Try this

#3


0  

I just found the right solution:

我刚刚找到了正确的解决方案:

var lStartDate = $("#datepicker").datepicker("option", "dateFormat", "dd-mm-yy").val()

#1


0  

Try out

$('#datepicker').datepicker({ dateFormat: 'dd-mm-yy' }).val();

#2


0  

<input type=text  data-date-format='dd/mm/yy' class="form-control" required> 

Try this

#3


0  

I just found the right solution:

我刚刚找到了正确的解决方案:

var lStartDate = $("#datepicker").datepicker("option", "dateFormat", "dd-mm-yy").val()