Here's an example code snippet to format date in the required format:
290 chars14 linesThe output will be something like Aug 10, 2022 8:13:45.789 PM based on the current date and time.
Intl.DateTimeFormat is a built-in API in JavaScript that allows internationalized formatting of dates and times. The options passed to the DateTimeFormat constructor specify the required format.
year, month and day are set to numeric and short to format the date as month day, yearhour, minute, and second are set to numeric to format the time as hour:minute:secondhour12 is set to true to display the time in AM/PM formatfractionalSecondDigits is set to 3 to display milliseconds with 3 digits.gistlibby LogSnag