我只是传递了价值观js,但不能 这是我的代码......
$(function() {
var ddate = document.getElementById("datetimepicker4").value;
$('#datetimepicker4').datetimepicker({
defaultDate: ddate,
useCurrent: false,
format: 'DD/MM/YYYY'
});
});

<input type='text' class="form-control" id='datetimepicker4' value="{{ \Carbon\Carbon::parse($data->created_at)->format('d/m/Y') }}" />
&#13;
答案 0 :(得分:1)
您可以使用解决方案
$(function () {
$('#datetimepicker4').datetimepicker({
format: 'DD/MM/YYYY'
});
});
&#13;
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/3.1.4/css/bootstrap-datetimepicker.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/3.1.4/js/bootstrap-datetimepicker.min.js"></script>
<input type='text' class="form-control" id='datetimepicker4' />
&#13;
希望这会对你有所帮助。