JavaScript setUTCDate () method
Examples
According to Universal Time (UTC) to set a day of the month:
var d = new Date();
d.setUTCDate(15);
d.setUTCDate(15);
d output:
try it"
Definition and Usage
setUTCDate () method is used according to Universal Time (UTC) to set a day of the month.
Tip: Coordinated Universal Time, also known as the unified world time, Universal Time, Coordinated Universal Time, abbreviated UTC (Universal Coordinated Time).
Note: UTC time is GMT (Greenwich Mean) time.
Browser Support
All major browsers support setUTCDate () method.
grammar
Date.setUTCDate( day )
Parameter Value
参数 | 描述 |
---|---|
day | 必需。要给 dateObject 设置的一个月中的某一天,用世界时表示。
该参数是 1 ~ 31 之间的整数:
如果本月时间有 31 天:
如果本月时间有 30 天:
|
return value
类型 | 描述 |
---|---|
Number | 1970年一月一日至调整过的日期的毫秒数。 |
technical details
JavaScript version: | 1.3 |
---|
More examples
Examples
Set the date for the last day of the previous month:
var d = new Date();
d.setUTCDate(0);
d.setUTCDate(0);
d output:
try it"
Examples
Setting a day of the month:
var d = new Date("July 21, 1983 01:15:00");
d.setUTCDate(15);
d.setUTCDate(15);
d resulting output:
try it"