There is no TimeSpan equivalent in JavaScript. toString()is a method that some "classes" implement, so it'll only work if the class of the object you're working on implements it. Sample: "Wed, 08 Apr 2015 15:48:22 GMT" toGMTString() Returns a string using the GMT time zone. toISOString() Returns a string that is ISO-8601 format in UTC timezone. Use formatProvider to specify culture-specific information used to format the Value.If formatProvider is null, the numeric portion of the string is formatted using a default NumberFormatInfo object set for the current culture.. See also. let dateString = date.toISOString().replace('T', ' ').replace(/\..+/, '') This will take your date, convert it into an ISO string (in the form 2020-01-10T03:09:24.551Z) and replace the T with a space and everything after the decimal with nothing. In the