I have made this with js:
// time
var date = new Date();
var currentTime = date.getHours() + ':' + date.getMinutes();
document.getElementById('timex').value = currentTime;
This script inserts the hour and minutes in a input.
There is a problem, at 16:06 the time becomes 16:6. And this causes a problem with the html input. The same thing happens at 1am. Become 1:34 and not 01:34.