Definition and Usage The toDateString() method returns the date portion of a Date object in readable form. Syntax dateObject.toDateS...
Definition and Usage
The toDateString() method returns the date portion of a Date object in readable form.
Syntax
dateObject.toDateString() |
Example 1
In the example below we will return the date portion of today's date:
<script type="text/javascript"> var d = new Date();
document.write(d.toDateString()); </script> |
The output of the code above will be:
Example 2
In the example below we will return the date portion of a specific date:
<script type="text/javascript"> var born = new Date("July 21, 1983 01:15:00");
document.write(born.toDateString()); </script> |
The output of the code above will be: