JavaScript Date getDate()

Definition and usage

getDate() The method returns the day of the month for the specified date (from 1 to 31).

Instance

Example 1

Return the day of the month in a month:

var d = new Date();
var n = d.getDate();

Try it yourself

Example 2

Return the day of the month from a specific date:

var d = new Date("July 21, 1983 01:15:00");
var n = d.getDate();

Try it yourself

Syntax

Date.getDate()

Parameters

No parameters.

Technical details

Return value: Numbers, from 1 to 31, representing the day of the month.
JavaScript version: ECMAScript 1

Browser support

Method Chrome IE Firefox Safari Opera
getDate() Support Support Support Support Support

Related Pages

Tutorial:JavaScript Date

Tutorial:JavaScript Date Format

Tutorial:JavaScript Object Constructor