getDate Method (Date) (JavaScript)

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

Syntax


dateObj.getDate()   

Parameters

The required dateObj reference is a Date object.

Return Value

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

Remarks

To get the day-of-the-month using Universal Coordinated Time (UTC), use the getUTCDate method.

Example

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  

Requirements

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported in Store apps (Windows 8 and Windows Phone 8.1). See Version Information.

Applies To: Date Object

See Also

getUTCDate Method (Date)
setDate Method (Date)
setUTCDate Method (Date)