Date.prototype.getUTCDate()

Date 实例的 getUTCDate() 方法根据世界时间返回该日期是月份中的哪一天。

¥The getUTCDate() method of Date instances returns the day of the month for this date according to universal time.

Try it

语法

¥Syntax

js
getUTCDate()

参数

¥Parameters

没有任何。

¥None.

返回值

¥Return value

1 到 31 之间的整数,表示根据通用时间给定日期的月份中的某一天。如果日期是 invalid,则返回 NaN

¥An integer, between 1 and 31, representing day of month for the given date according to universal time. Returns NaN if the date is invalid.

示例

¥Examples

使用 getUTCDate()

¥Using getUTCDate()

以下示例将当前日期的日期分配给变量 dayOfMonth

¥The following example assigns the day of month of the current date to the variable dayOfMonth.

js
const today = new Date();
const dayOfMonth = today.getUTCDate();

规范

Specification
ECMAScript Language Specification
# sec-date.prototype.getutcdate

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看