ISO 8601 to readable date

Asked Aug 1, 2021·1 reply·Last activity 5 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Hi there. I'm using a custom API with Nightbot and this custom API gives you an "updated at" date encoded in ISO 8601 (2021-07-30T15:40:23.000Z). Is there any way I can convert this date to a more human readable one within the command? Pretty sure can't do it with javascript math but I just don't know.

Thank you.

1 reply

Using vanilla js you can do the following:

js
const event = new Date('2021-07-30T15:40:23.000Z');
event.toString();
// "Fri Jul 30 2021 09:40:23 GMT-0600 (Mountain Daylight Time)"