javascript get hour from date
var myDate = new Date(2019, 11, 24, 10, 33);
var hour = myDate.getHours();
javascript get hour from date
var myDate = new Date(2019, 11, 24, 10, 33);
var hour = myDate.getHours();
javascript format hour
function timeConversion(s) {
const formatter = s.replace(/[a-z]/gi, '').split(':')
let firstIndex = +formatter[0]
let time = 12
let time1 = ""
let time2 = ""
for(let i = 0; i < formatter.length; i++) {
if(i == 0 && firstIndex < 12) {
time += +formatter[0]
time1 += String(time)
}
if(i == 0 && firstIndex > 11) {
time -= +formatter[0]
time1 += String(Math.abs(time)).repeat(2)
}
if(i !== 0) {
time2 += " " + formatter[i]
}
}
return time1.concat(time2).replace(/[s]/g, ':')
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us