how can I show format date " yyyy/mm/dd hh:mm " into input type "datettime-local" in the picture I missed "hh:mm"
Any idea ?
how can I show format date " yyyy/mm/dd hh:mm " into input type "datettime-local" in the picture I missed "hh:mm"
Any idea ?
Here is how I would do it in JavaScript:
var da = new Date();
var year = da.getFullYear(),
month = 1+da.getMonth(),
day = da.getDate(),
hours = da.getHours(),
mins = da.getMinutes();
if (month<10)
month = `0${month}`;
if (day<10)
day = `0${day}`;
if (hours<10)
hours = `0${hours}`;
if (mins<10)
mins = `0${mins}`;
var d = year+'/'+month+'/'+day,
t = hours+':'+mins,
result = d+' '+t;
document.write(result);
Check this out for alternative ways to achieve this result. There exist several external plugins that make it easier to format dates in JavaScript and jQuery.