|
| JAVASCRIPT getUTCDate() METHOD
The getUTCDate() method in javascript returns the day of the month as an integer from 1 to 31 in UTC (Universal Coordinated Time).
The general format is:
dateObject.getUTCDate();
If you want to return the day of month with getUTCDate() method, you will first have to create a new date object and then use the new date object with the getUTCDate() method.
Example 1: Using getUTCDate() for today's day of the month:
<script type="text/javascript">
var dd=new Date(); // creates a new date object
dd=dd.getUTCDate(); // returns the day
doument.write(dd); // outputs the day
</script>
The above will output:
Example 2: Using getUTCDate() for day of the month of specified date:
<script type="text/javascript">
var dd=new Date("December 16, 2005 02:03:06");
dd=dd.getUTCDate();
doument.write(dd);
</script>
The above will output:
See Also:
|
|