Date.prototype.getUTCDate()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

getUTCDate() 方法以世界时为标准,返回一个指定的日期对象为一个月中的第几天

尝试一下

语法

dateObj.getUTCDate()

参数

返回值

getUTCDate() 返回一个 1 到 31 的整数值

示例

示例:使用 getUTCDate() 方法

下面的例子是把当前日期的天数部分赋值给变量 day.

js
var today = new Date();
var day = today.getUTCDate();

规范

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

浏览器兼容性

BCD tables only load in the browser

参见