| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime | [Back] [Original] |
Get to know MDN better
Esta pgina ha sido traducida del ingls por la comunidad. Aprende ms y nete a la comunidad de MDN Web Docs.
This feature is well established and works across many devices and browser versions. Its been available across browsers since julio de 2015.
El mtodo getTime() devuelve el valor numrico correspondiente a la hora para la fecha especificada segn la hora universal.
Puede utilizar este mtodo para ayudar a asignar una fecha y hora a otro objeto Date. Este mtodo es funcionalmente equivalente al metodo valueOf().
dateObj.getTime()
El valor devuelto por el mtodo getTime() es un nmero de milisegundos desde el 1 de enero de 1970 00:00:00 UTC.
getTime() para copiar fechasConstruir un objeto de fecha con el mismo valor de tiempo.
var birthday = new Date(1994, 12, 10);
var copy = new Date();
copy.setTime(birthday.getTime());
Restando dos llamadas getTime() subsiguientes en objetos Date recin generados, d el intervalo de tiempo entre estas dos llamadas. Esto se puede utilizar para calcular el tiempo de ejecucin de algunas operaciones.
var end, start;
start = new Date();
for (var i = 0; i < 1000; i++) {
Math.sqrt(i);
}
end = new Date();
console.log("Operation took " + (end.getTime() - start.getTime()) + " msec");
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-date.prototype.gettime |
This page was last modified on 29 may 2026 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()getTimezoneOffset()getUTCDate()getUTCDay()Date.prototype.getUTCFullYear()getUTCHours()getUTCMilliseconds()getUTCMinutes()getUTCMonth()getUTCSeconds()getYear()setDate()Date.prototype.setFullYear()setHours()setMilliseconds()setMinutes()Date.prototype.setMonth()setSeconds()setTime()setUTCDate()setUTCFullYear()setUTCHours()setUTCMilliseconds()setUTCMinutes()setUTCMonth()setUTCSeconds()setYear()Date.prototype.toDateString()Date.prototype.toISOString()Date.prototype.toJSON()Date.prototype.toLocaleDateString()Date.prototype.toLocaleString()Date.prototype.toLocaleTimeString()toString()toTemporalInstant()toTimeString()Date.prototype.toUTCString()valueOf()[Symbol.toPrimitive]()Object/FunctionYour 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 |