|
| JAVASCRIPT setDate() METHOD
The setDate() method in javascript sets the date of the current month. Takes a required numeric value from 0 to 31 as its argument.
The general format is:
dateObject.setDate(value);
If you want to return the full date with the setDate() method, you will first have to create a new date object and then use the new date object with the setDate() method.
Example:
<script type="text/javascript">
var dd=new Date(); // creates a new date object
dd.setDate(10); // sets the date to 10th of current month
document.write(dd); // outputs the date
</script>
The above will output:
See Also:
|
|