我正在使用bootstrap-timepicker。
在页面加载时,我试图从该选择器获取当前时间。
ParcelUuid pUuid = new ParcelUuid(UUID.fromString("00001234-0000-1000-8000-00805F9B34FB");
我找到了页面加载功能,但是如何获得时间?
答案 0 :(得分:1)
你可以这样做:
$('#starts-on').timepicker('setTime', new Date().getHours() + ':' + new Date().getMinutes());
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-timepicker/0.5.2/js/bootstrap-timepicker.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-timepicker/0.5.2/css/bootstrap-timepicker.min.css" rel="stylesheet" />
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="bootstrap-timepicker">
<input id="starts-on" type="text" class="input-small">
<i class="icon-time"></i>
</div>