Date.prototype.getUTCDay() Date
实例的 getUTCDay()
方法根据世界时间返回该日期是星期几,其中 0 代表星期日。
¥The getUTCDay()
method of Date
instances returns the day of the week for this date according to universal time, where 0 represents Sunday.
¥Return value
根据通用时间,对应于给定日期的星期几的整数:0 表示星期日,1 表示星期一,2 表示星期二,依此类推。如果日期是 invalid ,则返回 NaN
。
¥An integer corresponding to the day of the week for the given date according to universal time: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on. Returns NaN
if the date is invalid .
¥Using getUTCDay()
以下示例将当前日期的工作日部分分配给变量 weekday
。
¥The following example assigns the weekday portion of the current date to the variable weekday
.
const today = new Date ( ) ;
const weekday = today. getUTCDay ( ) ;
BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.