SHERIN AS SHERIN AS - 1 year ago 105
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>

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

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


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 Source
document.getElementById("demo").innerHTML = new Date("2015-03-25").toISOString();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download