programming-examples/js/Date/Write a JavaScript function to get 24-hour format of an hour without leading zeros..js
2019-11-15 12:59:38 +01:00

10 lines
220 B
JavaScript

function hours_without_zeroes(dt)
{
return dt.getHours();
}
dt = new Date();
console.log(hours_without_zeroes(dt));
dt = new Date(1989, 10, 1);
console.log(hours_without_zeroes(dt));