You can just set the value
of the input field with the respective formats:
date
is yyyy-MM-dd
time
is HH:mm
Using your example, you can do something simple like:
var date = new Date();
var currentDate = date.toISOString().substring(0,10);
var currentTime = date.toISOString().substring(11,16);
document.getElementById('currentDate').value = currentDate;
document.getElementById('currentTime').value = currentTime;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…