Skip to main content
Active reading [<https://www.youtube.com/watch?v=1Dax90QyXgI&t=17m54s>].
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

With the ability to render in a custom format and using the month name in different locales:

const locale = 'en-us'; const d = new Date(date); const day = d.getDate(); const month = d.toLocaleString(locale, { month: 'long' }); const year = d.getFullYear(); const time = d.toLocaleString(locale, { hour12: false, hour: 'numeric', minute: 'numeric'}); return `${month} ${day}, ${year} @ ${time}`; // May 5, 2019 @ 23:41 

With ability to render in custom format and using month name in different locales:

const locale = 'en-us'; const d = new Date(date); const day = d.getDate(); const month = d.toLocaleString(locale, { month: 'long' }); const year = d.getFullYear(); const time = d.toLocaleString(locale, { hour12: false, hour: 'numeric', minute: 'numeric'}); return `${month} ${day}, ${year} @ ${time}`; // May 5, 2019 @ 23:41 

With the ability to render in a custom format and using the month name in different locales:

const locale = 'en-us'; const d = new Date(date); const day = d.getDate(); const month = d.toLocaleString(locale, { month: 'long' }); const year = d.getFullYear(); const time = d.toLocaleString(locale, { hour12: false, hour: 'numeric', minute: 'numeric'}); return `${month} ${day}, ${year} @ ${time}`; // May 5, 2019 @ 23:41 
Source Link
Alex Ivasyuv
  • 8.9k
  • 18
  • 77
  • 91

With ability to render in custom format and using month name in different locales:

const locale = 'en-us'; const d = new Date(date); const day = d.getDate(); const month = d.toLocaleString(locale, { month: 'long' }); const year = d.getFullYear(); const time = d.toLocaleString(locale, { hour12: false, hour: 'numeric', minute: 'numeric'}); return `${month} ${day}, ${year} @ ${time}`; // May 5, 2019 @ 23:41