| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Date/valueOf | [Back] [Original] |
Get to know MDN better
Esta pgina foi traduzida do ingls pela comunidade. Saiba mais e junte-se comunidade MDN Web Docs.
This feature is well established and works across many devices and browser versions. Its been available across browsers since julho de 2015.
O mtodo valueOf() retorna o valor primitivo do objeto Date.
const date1 = new Date(Date.UTC(96, 1, 2, 3, 4, 5));
console.log(date1.valueOf());
// Expected output: 823230245000
const date2 = new Date("02 Feb 1996 03:04:05 GMT");
console.log(date2.valueOf());
// Expected output: 823230245000
dateObj.valueOf()
O nmero de milissegundos entre 1 de Janeiro de 1970 00:00:00 UTC e a data.
O mtodo valueOf() retorna o valor primitivo do objeto Date como um tipo de dado numrico, o nmero de milissegundos desde a meia noite do dia 1 de Janeiro de 1970 UTC.
Este mtodo funcionalmente equivalente ao mtodo Date.prototype.getTime().
Este mtodo geralmente chamado internamente pelo JavaScript e no explcito em cdigo.
valueOf()var x = new Date(56, 6, 17);
var myVar = x.valueOf(); // atribui -424713600000 to myVar
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-date.prototype.valueof |
This page was last modified on 17 de fev. de 2025 by MDN contributors.
DateDate.prototype.getDate()Date.prototype.getDay()Date.prototype.getFullYear()Date.prototype.getHours()Date.prototype.getMilliseconds()Date.prototype.getMinutes()Date.prototype.getMonth()Date.prototype.getSeconds()Date.prototype.getTime()Date.prototype.getTimezoneOffset()Date.prototype.getUTCDate()Date.prototype.getUTCDay()Date.prototype.getUTCFullYear()Date.prototype.getUTCHours()Date.prototype.getUTCMilliseconds()Date.prototype.getUTCMinutes()Date.prototype.getUTCMonth()Date.prototype.getUTCSeconds()Date.prototype.getYear()Date.prototype.setDate()Date.prototype.setFullYear()Date.prototype.setHours()Date.prototype.setMilliseconds()Date.prototype.setMinutes()Date.prototype.setMonth()Date.prototype.setSeconds()Date.prototype.setTime()Date.prototype.setUTCDate()Date.prototype.setUTCFullYear()Date.prototype.setUTCHours()Date.prototype.setUTCMilliseconds()Date.prototype.setUTCMinutes()Date.prototype.setUTCMonth()Date.prototype.setUTCSeconds()Date.prototype.setYear()Date.prototype.toDateString()Date.prototype.toISOString()Date.prototype.toJSON()Date.prototype.toLocaleDateString()toLocaleString()Date.prototype.toLocaleTimeString()Date.prototype.toString()toTemporalInstant()Date.prototype.toTimeString()Date.prototype.toUTCString()Date.prototype.valueOf()Date.prototype[@@toPrimitive]Object/FunctionObject.prototype.__defineGetter__()Object.prototype.__defineSetter__()Object.prototype.__lookupGetter__()Object.prototype.__lookupSetter__()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toLocaleString()Object.prototype.toString()Object.prototype.valueOf()Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |