Search code examples
javascriptjquerystringdateutc

How to convert a UTC String to a Formatted Date in jQuery


I have a UTC Date as follows: Mon Aug 30 2021 00:00:00 GMT-0400 (Eastern Daylight Time)

Is there any jQuery or JavaScript function that converts the UTC date string to mm/dd/yyyy format?

I searched high and low and cannot find anything. Thanks!


Solution

  • you can use Date.parse and Intl.datetimeformat as in

    console.log(new Intl.DateTimeFormat('en-US').format(Date.parse("Mon Aug 30 2021 00:00:00 GMT-0400 (Eastern Daylight Time)")));