Ad
Date Time

ShowDate()

function ShowDate() {
let agora = new Date()
let day = agora.getDay()
let month = agora.getMonth()
let year = agora.getFullYear()

console.log(${month}/${day}/${year})
}

Code
Diff
  • ShowDate()
    
    function ShowDate() {
      let agora = new Date()
      let day = agora.getDay()
      let month = agora.getMonth()
      let year = agora.getFullYear()
      
      console.log(`${month}/${day}/${year}`)
    }
    • ShowDate()
    • function ShowDate() {
    • const days = {'1':'st','2':'nd','3':'rd'};
    • const date = new Date().toLocaleDateString('en', {month: 'long', day: 'numeric', year: 'numeric'})
    • const dateFixed = date.replace(',', days[new Date().getDate()]?? 'th')
    • return dateFixed
    • let agora = new Date()
    • let day = agora.getDay()
    • let month = agora.getMonth()
    • let year = agora.getFullYear()
    • console.log(`${month}/${day}/${year}`)
    • }