The current time is displayed on the jsp page, the current time code is displayed in the input.
Display the current time (Real-Time refresh) somewhere on the page 1. display the current time on the jsp page
Current Time:<Script> document. getElementById ('ctime '). innerHTML = new Date (). toLocaleString (); setInterval ("document. getElementById ('ctime '). innerHTML = new Date (). toLocaleString (); ", 1000); </script>2. display the current time in input
var today=new Date(); var submitTime=today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate(); $("#time").attr('value',submitTime);3. Set the time format (bootstrap) by yourself)
$ (". Form_datetime "). datetimepicker ({language: 'zh-cn', autoclose: true, minView: "month", // after the date is selected, no jump will be made to select the time, minute, and second format: "yyyy-mm-dd", // after the date is selected, the date format displayed in the text box is pickerPosition: ("bottom-left")}); $ (". form_advance_datetime "). datetimepicker ({language: 'zh-cn', format: "dd MM yyyy-hh: ii", autoclose: true, todayBtn: true, startDate: "", pickerPosition: ("bottom-left"), minuteStep: 10}); $ (". form_meridian_datetime "). datetimepicker ({language: 'zh-cn', format: "dd MM yyyy-HH: ii P", showMeridian: true, autoclose: true, pickerPosition: ("bottom-left"), todayBtn: true });