--- title: Date.prototype.setUTCDate() slug: Web/JavaScript/Reference/Global_Objects/Date/setUTCDate translation_of: Web/JavaScript/Reference/Global_Objects/Date/setUTCDate original_slug: Web/JavaScript/Referencia/Objectes_globals/Date/setUTCDate ---
El mètode setUTCDate()
assigna el dia del mes per a una data especificada, en temps universal.
objecteData.setUTCDate(dia)
dia
If a parameter you specify is outside of the expected range, setUTCDate()
attempts to update the date information in the {{jsxref("Date")}} object accordingly. For example, if you use 40 for dayValue
, and the month stored in the {{jsxref("Date")}} object is June, the day will be changed to 10 and the month will be incremented to July.
Si es passa un paràmetre que està fora del rang esperat, el mètode setUTCDate()
actualitza els altres paràmetres per a acceptar el nombre. Per exemple, si es passa 40 com a dia
, i el mes especificat a l'objecte {{jsxref("Date")}} és juny, el dia es canviarà a 10 i el mes serà incrementat a juliol.
setUTCDate()
var elGranDia = new Date(); elGranDia.setUTCDate(20);
Especificació | Estat | Comentaris |
---|---|---|
{{SpecName('ES1')}} | {{Spec2('ES1')}} | Definició inicial. Implementat a JavaScript 1.3. |
{{SpecName('ES5.1', '#sec-15.9.5.37', 'Date.prototype.setUTCDate')}} | {{Spec2('ES5.1')}} | |
{{SpecName('ES6', '#sec-date.prototype.setutcdate', 'Date.prototype.setUTCDate')}} | {{Spec2('ES6')}} |
Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Suport bàsic | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
Característica | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Suport bàsic | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |