Prev Demo
JavaScript
>
Todatestring() Method
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <p>Click the below button to convert the only date of a date object into seperate string.</p> <input type="button" value="Click" onclick="myDate()" /> <p id="myId"></p> <script> var A = new Date(); //* Returns the date & time as per the internet network *// alert(A); //* Displays the Var A result in the alert box *// function myDate() { var R = A.toDateString(); //* Converts the date of a date object into readable string *// document.getElementById("myId").innerHTML = R; } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output