Date.prototype.setUTCDate()
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.
O método setUTCDate()
atribui o dia do mês para uma data especifica de acordo com o horário universal.
Experimente
const event = new Date("August 19, 1975 23:15:30 GMT-3:00");
console.log(event.getUTCDate());
// Expected output: 20
event.setUTCDate(19);
console.log(event.getUTCDate());
// Expected output: 19
Sintaxe
dateObj.setUTCDate(dayValue)
Parâmetros
dayValue
-
Um inteiro entre 1 e 31, representando o dia do mês.
Valor de retorno
O número de milissegundos entre 1 de Janeiro de 1970 00:00:00 UTC e a data atualizada.
Descrição
Exemplos
Usando setUTCDate()
js
var theBigDay = new Date();
theBigDay.setUTCDate(20);
Especificações
Specification |
---|
ECMAScript® 2025 Language Specification # sec-date.prototype.setutcdate |
Compatibilidade com navegadores
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
setUTCDate |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.