How to format date in JavaScript

Datetime
By Jad Joubran · 
Last updated Aug 16, 2020
const date = new Date();

// remove an option to hide it from the output
const options = {
  weekday: "long", // or: "short", "numeric"
  month: "long", //or: "short", "numeric"
  day: "numeric",
  year: "numeric",
  day: "numeric",
  hour: "numeric",
  minute: "numeric",
  second: "numeric"
};

// replace "en-US" with undefined to use the user's locale
new Intl.DateTimeFormat("en-US", options).format(date);
Sunday, August 16, 2020, 7:34:44 PM