JavaScript toDateString() Method
Complete Date Object Reference
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:
Try-It-Yourself Demos
toDateString()
How to use toDateString() to return the date portion of today's date.
Complete Date Object Reference
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|