Using JavaScript getDate() Method

The getDate() method will returns the day of the month (from 1 to 31) for the specified date, according to local system time.It is always use with the Javascript Date object.

Sysntax is
Date.getDate();

This method is supported by all main browser.

Example:
Return the day of the month:

    <script type="text/javascript">
    var MyDate=new Date();
    document.write(MyDate.getDate());
 </script>
<!--Output will be Date of your local system-->

Return the day of the month from a specific date:

    <script type="text/javascript">
    var MyDate=new Date("May 25, 2012 02:25:00");
    document.write(MyDate.getDate());
 </script>
 <!--Output will be 25-->
Tags: , ,

Join Us!