get hours and minutes in minutes code example
Example 1: how to show only time in hours and minutes only in javascript
function prettyDate2(time) {
var date = new Date(parseInt(time));
return date.toLocaleTimeString(navigator.language, {
hour: '2-digit',
minute:'2-digit'
});
}
Example 2: js date get hours
const birthday = new Date('March 13, 08 04:20');
console.log(birthday.getHours());
// expected output: 4