This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

getDate

Summary

Gets the day-of-the-month, using local time.

Syntax

dateObj.getDate()

Return Value

An integer between 1 and 31 that represents the day-of-the-month.

Examples

The following example illustrates the use of the getDate method.

var date = new Date("Jan 01, 2001");
 var str = "Today's date is: ";
    str += (date.getMonth() + 1) + "/";
    str += date.getDate() + "/";
    str += date.getFullYear();
 document.write(str);

 // Output: Today's date is: 1/1/2001

Remarks

The required dateObj reference is a Date object. To get the day-of-the-month using Universal Coordinated Time (UTC), use the getUTCDate method.

See also

Other articles

Attributions

  • Microsoft Developer Network: Article