Just crop the string:

var date = new Date("2013-03-10T02:00:00Z");
date.toISOString().substring(0, 10);

Or if you need only date out of string.

var strDate = "2013-03-10T02:00:00Z";
strDate.substring(0, 10);
Answer from DriveByPoster on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › toISOString
Date.prototype.toISOString() - JavaScript | MDN
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).
🌐
W3Schools
w3schools.com › jsref › jsref_toisostring.asp
JavaScript Date toISOString() Method
❮ Previous JavaScript Date Reference ... using the ISO standard. The standard is called ISO-8601 and the format is: YYYY-MM-DDTHH:mm:ss.sssZ ·...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date
Date - JavaScript | MDN
The JavaScript specification only specifies one format to be universally supported: the date time string format, a simplification of the ISO 8601 calendar date extended format.
🌐
Day.js
day.js.org › docs › en › display › format
Format · Day.js
dayjs().format() // current date in ISO8601, without fraction seconds e.g.
🌐
W3Schools
w3schools.com › js › js_date_formats.asp
JavaScript Date Formats
ISO dates can be written without month and day (YYYY): ... Time zones will vary the result above between December 31 2014 and January 01 2015. ISO dates can be written with added hours, minutes, and seconds (YYYY-MM-DDTHH:MM:SSZ):
🌐
Medium
ckramp.medium.com › converting-iso-8601-date-format-to-javascript-mm-dd-yyyy-date-format-cab0dda9c9b7
Converting ISO-8601 date format to JavaScript MM/DD/YYYY date format - Christian Kramp - Medium
November 26, 2022 - var isodate = new Date("2021-12-31T00:00:00.000Z"); var localedateformat = isodate.toLocaleDateString('en-US'); What you’ll get is the following format: mm/dd/yyyy. This is the format for the US.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-date-toisostring-method
JavaScript Date toISOString() Method - GeeksforGeeks
July 11, 2025 - The date.toISOString() method is used to convert the given data object’s contents into a string in ISO format (ISO 8601) i.e. in the form of (YYYY-MM-DDTHH:mm:ss.sssZ or ±YYYYYY-MM-DDTHH:mm:ss.sssZ).
Find elsewhere
🌐
DEV Community
dev.to › musatov › the-subtle-trap-of-iso-date-strings-in-javascript-49co
The Subtle Trap of ISO Date Strings in JavaScript - DEV Community
May 26, 2025 - If your goal is to treat stored datetimes as absolute moments in time, make sure your ISO strings end with a Z. That tells JavaScript (and pretty much every parser) that this value is in UTC—no ambiguity, no surprises.
🌐
GitHub
gist.github.com › barbietunnie › 67d10b59f7716e3ff5892d70dd9a3cfa
Format JS Date in ISO-8601 without timezone issues · GitHub
/** * Formats the provided date in _ISO-8601 format_ without using * `toISOString()` to avoid timezone issues * * @param date The Date object * @returns {string} */ function formatDate(date) { return [ `${date.getFullYear()}`, `${date.getMonth() ...
🌐
SheCodes
shecodes.io › athena › 1913-convert-time-in-rfc3339-format-in-javascript
[JavaScript] - Convert Time in RFC3339 Format in JavaScript | SheCodes
Learn how to convert time into RFC3339 format (ISO 8601) using JavaScript's toISOString() method of the Date object
🌐
MSR
rajamsr.com › home › the best way to convert javascript date to iso string
The Best Way to Convert JavaScript Date to ISO String | MSR - Web Dev Simplified
February 24, 2024 - The Intl.DateTimeFormat() object is a more advanced and powerful way to convert a date object to an ISO string. It returns a string in a format that is customized according to the given locale, options, and time zone.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › parse
Date.parse() - JavaScript | MDN
// Standard date-time string format const unixTimeZero = Date.parse("1970-01-01T00:00:00Z"); // Non-standard format resembling toUTCString() const javaScriptRelease = Date.parse("04 Dec 1995 00:12:00 GMT"); console.log(unixTimeZero); // Expected output: 0 console.log(javaScriptRelease); // Expected output: 818035920000
🌐
Reddit
reddit.com › r/iso8601 › javascript has a built in "to iso date string" method for their date object. why don't more software devs just use the built in function?
r/ISO8601 on Reddit: JavaScript has a built in "To ISO Date String" method for their date object. Why don't more software devs just use the built in function?
July 30, 2021 - My point was that if a string representation is used it should be ISO 8601, wasn't clear about that. My bad. ... Yes, it's the most common format here. That said, we technically allow two numeric formats here. ... The former is much more common though. The separators are critical here, that's how we avoid confusion. We also often use non-numeric representation by writing out the month's name. But if you just ask a random Swede to write the date numerically then yes, you are most likely to get it in ISO8601.
🌐
Moment.js
momentjs.com › docs
Moment.js | Docs
Get + Set Millisecond Second Minute Hour Date of Month Day of Week Day of Week (Locale Aware) ISO Day of Week Day of Year Week of Year Week of Year (ISO) Month Quarter Year Week Year Week Year (ISO) Weeks In Year Weeks In Year (ISO) Get Set Maximum Minimum · Manipulate Add Subtract Start of Time End of Time Maximum Minimum Local UTC UTC offset Time zone Offset · Display Format Time from now Time from X Time to now Time to X Calendar Time Difference Unix Timestamp (milliseconds) Unix Timestamp (seconds) Days in Month As Javascript Date As Array As JSON As ISO 8601 String As Object As String Inspect
🌐
GoLinuxCloud
golinuxcloud.com › home › javascript › converting js dates to iso date strings [solved]
Converting JS Dates to ISO Date Strings [SOLVED] | GoLinuxCloud
April 20, 2023 - Custom formats: Application-specific formats, such as “MM-DD-YYYY” or “DD/MM/YYYY”. There are several ways to convert a JavaScript date object to an ISO date string.
🌐
LabEx
labex.io › tutorials › string-is-iso-formatted-date-28422
Validating ISO Formatted Dates in JavaScript | LabEx
When you create a new Date object, you can pass an ISO-formatted string to it: const date = new Date("2023-05-12T14:30:15.123Z"); Let us open the terminal and practice working with Date objects: Open the Terminal by clicking on the Terminal ...