SHERIN AS SHERIN AS - 3 months ago 6
CSS Question

javascript date in specified format

i need to convert date to "2015-03-25T00:00:00.000Z" this format in javascript
i use the following code



<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML = new Date("2015-03-25");
</script>

</body>
</html>





i get the result like this
Wed Mar 25 2015 00:00:00 GMT+0530 (India Standard Time)
but i need the following format "2015-03-25T00:00:00.000Z"

Answer
document.getElementById("demo").innerHTML = new Date("2015-03-25").toISOString();