Latest web development tutorials

JavaScript getDate () method

Date Object Reference JavaScript Date Object

Examples

Returns a day of the month:

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

n output:

var d = new Date() document.write(d.getDate())

try it"

Definition and Usage

getDate () method returns a day of the month.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support getDate () method


grammar

Date.getDate()

return value

Type 描述
Number dateObject 所指的月份中的某一天,使用本地时间。返回值是 1 ~ 31 之间的一个整数。

technical details

JavaScript version: 1.1


More examples

Examples

Returns the specified time of the day of the month:

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

Output:

21

try it"


Date Object Reference JavaScript Date Object