[英]How to change the date format in Bootstrap date picker?
在我的表單中,我有以下代碼顯示date picker
。 我正在使用bootstrap
<div class="form-group row">
<label for="Quantity" class="col-sm-3 col-form-label">Required Date</label>
<div class="col-sm-9">
<div class="input-group">
<input class="form-control" id="date" name="date" placeholder="MM/DD/YYYY" type="text"/>
<div class="input-group-addon">
<i class="fas fa-calendar-alt"></i>
</div>
</div>
</div>
</div>
我得到的日期格式是MM / DD / YYYY。 但是我需要的格式是DD / MM / YYYY。 我該如何更改? 如果我可以將屬性添加到更好的表單字段,而不是jquery的javascript。
您需要在jQuery
定義一次格式。
// here assumed that `datepicker` is the class name for using date picker
$('.datepicker').datepicker({
format: 'DD/MM/YYYY'
});
// as per your code, you can update for specific id
$('#date').datepicker({
format: 'DD/MM/YYYY'
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.