我想将日期格式从yyyy-mm-dd
更改为dd-mm-yyyy
,但我不能。
我的观点:
<div class="form-group">
<label class="control-label labelnya"><i class="fa fa-calendar-o"></i> Tanggal Surat : </label>
<div class="input-group date" id="datepickerDemo17">
<div class="has-success">
<input type="text" class="form-control inputan " name="tgl_surat" placeholder="Masukan Waktu Penetapan"/>
</div>
<span class="input-group-addon tomb_calender" style="padding: 5px 15px; line-height: 0;">
<i class=" ion ion-calendar"></i>
</span>
</div>
答案 0 :(得分:3)
如果您使用jquery日期选择器
<script>
$( function() {
$( "#datepicker" ).datepicker( "option", "dateFormat", "dd-mm-yy" );
} );
</script>
或PHP
$date = date('d-m-Y', strtotime($old_format_date) );
答案 1 :(得分:1)
<div class="form-group">
<label class="control-label labelnya"><i class="fa fa-calendar-o"></i> Tanggal Surat : </label>
<div class="input-group date" id="datepickerDemo17">
<div class="has-success">
<input type="text" class="form-control inputan kusus" id="tgl_surat" data-format="dd-MM-yyyy" name="tgl_surat" placeholder="Masukan Waktu Penetapan"/>
</div>
<span class="input-group-addon tomb_calender" style="padding: 5px 15px; line-height: 0;">
<i class=" ion ion-calendar"></i>
</span>
</div>
</div>
<script type="text/javascript">
$(function(){
$("#tgl_surat").datepicker({
todayHighlight: true,
format: "dd-mm-yyyy"
});
})
</script>