var myDate = new Date().toTimeString().replace(/.*(d{2}:d{2}:d{2}).*/, "$1"); console.log(myDate) //using regex