Date.prototype.toISOString()

The toISOString() method of Date instances returns a string representing this date in the date time string format , a simplified format based on ISO 8601 , which is always 24 or 27 characters long ( YYYY-MM-DDTHH:mm:ss.sssZ or ±YYYYYY-MM-DDTHH:mm:ss.sssZ , respectively). The timezone is always UTC, as denoted by the suffix Z .

Try it