const options = { year: 'numeric', month: 'short', day: 'numeric', timeZone: 'UTC' }const date = new Date() // Fri Mar 06 2020 12:47:43 GMT+0800 (Malaysia Time)const output = date.toLocaleTimeString('en-US', options) // Mar 6, 2020, 4:47:43 AM// ordate.toISOString() // 2020-03-06T04:47:43.000Z
const dateStr = '2020-03-06T04:47:43.000Z'const date = new Date(dateStr) // Fri Mar 06 2020 12:47:43 GMT+0800 (Malaysia Time)const output = date.toLocaleTimeString('en-US', options) // Mar 6, 2020, 4:47:43 AM
❤️ Is this article helpful?
Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.
Do send some 💖 to @d_luaz or share this article.
✨ By Desmond Lua
A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz
👶 Apps I built
Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.