Ad
Date Time
Code
Diff
  • 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
    }
    • function ShowDate() {
    • const months = {'Jan':'January','Feb':'February','Mar':'March','Apr':'April','May':'May',
    • 'Jun':'June','Jul':'July','Aug':'Augest','Sep':'September','Oct':'October',
    • 'Nov':'November','Dec':'December'};
    • const days = {'1':'st','2':'nd','3':'rd'};
    • return new Date().toDateString().slice(4).split(' ').map((e,i) => i?i==1?+e+(days[e.slice(-1)]||'th'):e:months[e]).join(' ');
    • const date = new Date().toLocaleDateString('en', {month: 'long', day: 'numeric', year: 'numeric'})
    • const dateFixed = date.replace(',', days[new Date().getDate()]?? 'th')
    • return dateFixed
    • }