I am creating a live application for current weather in a city searched. However, I am just working on displaying the time of the current time on my end at the moment and I am wondering how to fix it to firstly display it as 17:06 instead of the current 17:6 and also how to if wanted to display it as 5:06pm instead of in military style. Thanks!
function formatDate(theDate) {
  let now = new Date();
  let currentDate = document.querySelector("#currentDate");
  console.log(now.getDate());
  console.log(now.getMilliseconds());
  console.log(now.getDay());
  console.log(now.getFullYear());
  console.log(now.getMonth());
  let date = now.getDate();
  let hours = now.getHours();
  let minutes = now.getMinutes();
  let year = now.getFullYear();
  let days = [
    "Sunday",
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
  ];
  let months = [
    "Jan",
    "Feb",
    "March",
    "April",
    "May",
    "June",
    "July",
    "Aug",
    "Sept",
    "Oct",
    "Nov",
    "Dec",
  ];
  let day = days[now.getDay()];
  let month = months[now.getMonth()];
  currentDate.innerHTML = ` ${day} ${hours}:${minutes}`;
  return theDate;
}
window.onload = formatDate();
function currentCity() {
  event.preventDefault();
  let city = document.querySelector("#city");
  city.innerHTML = "Works";
}
function searchCity() {
  event.preventDefault();
  let serachInput = document.querySelector("#search-input");
}
let runSearch = document.querySelector("#search-button");
runSearch.addEventListener("click", currentCity);