English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
setUTCDate()According to the world time setting, set the day of the month in the Date object (1 ~ 31)。
World Standard Time (UTC) is the standard time set for world time.
Expected value is1-31, but other values are allowed:
0 represents the last day of the previous month
-1represents the day before the last day of the previous month
If a month has31day:
32is the first day of the next month
If a month has30 days:
32is the second day of the next month
date.setUTCDate(day)
var d = new Date(); d.setUTCDate(12);Test and see‹/›
All browsers fully support the setUTCDate() method:
Method | |||||
setUTCDate() | is | is | is | is | is |
Parameter | Description |
---|---|
day | 1to31An integer between the two dates, representing a day in the month |
Return Value: | 1970 Year1Month1Milliseconds between the date 00:00:00 UTC and the update date |
---|---|
JavaScript Version: | ECMAScript 1 |
This example sets the last day of the month to the last day of the previous month:
var d = new Date(); d.setUTCDate(0);Test and see‹/›