JSFiddle - React, Tailwind, and code Playground

by dipeshbeckham

JavaScript

function MythelDateFunction() {
  const newDate = new Date('2021-07-08T16:41:11.793Z')

  const dates = newDate
        .toUTCString()
        .replace(/(\d+)\/(\d+)\/(\d+)/g, '$3/$1/$2')
        .split('/')
        .map((v) => (v.length === 1 ? `0${v}` : v))
        .join('/')


   const newTime = newDate
        .toTimeString()
        .substr(0, 5)      

      return `${dates} ${newTime}`
}

alert(MythelDateFunction())