aboutsummaryrefslogtreecommitdiff
path: root/files/ca/web/javascript/reference/global_objects/date/now
diff options
context:
space:
mode:
authorFlorian Merz <me@fiji-flo.de>2021-02-11 14:45:12 +0100
committerFlorian Merz <me@fiji-flo.de>2021-02-11 14:45:12 +0100
commitcb9e359a51c3249d8f5157db69d43fd413ddeda6 (patch)
treeae3040d626c3b5717da5bda2af9f0a9ff9bd389f /files/ca/web/javascript/reference/global_objects/date/now
parent8260a606c143e6b55a467edf017a56bdcd6cba7e (diff)
downloadtranslated-content-cb9e359a51c3249d8f5157db69d43fd413ddeda6.tar.gz
translated-content-cb9e359a51c3249d8f5157db69d43fd413ddeda6.tar.bz2
translated-content-cb9e359a51c3249d8f5157db69d43fd413ddeda6.zip
unslug ca: move
Diffstat (limited to 'files/ca/web/javascript/reference/global_objects/date/now')
-rw-r--r--files/ca/web/javascript/reference/global_objects/date/now/index.html126
1 files changed, 126 insertions, 0 deletions
diff --git a/files/ca/web/javascript/reference/global_objects/date/now/index.html b/files/ca/web/javascript/reference/global_objects/date/now/index.html
new file mode 100644
index 0000000000..c3ef05fa86
--- /dev/null
+++ b/files/ca/web/javascript/reference/global_objects/date/now/index.html
@@ -0,0 +1,126 @@
+---
+title: Date.now()
+slug: Web/JavaScript/Referencia/Objectes_globals/Date/now
+translation_of: Web/JavaScript/Reference/Global_Objects/Date/now
+---
+<div>{{JSRef("Global_Objects", "Date")}}</div>
+
+<h2 id="Summary" name="Summary">Resum</h2>
+
+<p>El mètode <strong><code>Date.now()</code></strong> retorna el nombre de milisegons que han passat des de l'1 de gener de 1970 00:00:00 UTC.</p>
+
+<h2 id="Syntax" name="Syntax">Sintaxi</h2>
+
+<pre class="syntaxbox"><code>var timeInMs = Date.now();</code></pre>
+
+<h3 id="Parameters" name="Parameters">Paràmetres</h3>
+
+<p>Cap.</p>
+
+<h2 id="Description" name="Description">Descripció</h2>
+
+<p>El mètode <code>now()</code> retorna el nombre de method returns el nombre de milisegons que han passat des de l'1 de gener de 1970 00:00:00 UTC fins al moment actual representat en un  {{jsxref("Global_Objects/Number", "Nombre")}}.</p>
+
+<p>Com que <code>now()</code> és un mètode estàtic de {{jsxref("Global_Objects/Date", "Date")}}, sempre es crida com a <code>Date.now()</code>.</p>
+
+<h2 id="Polyfill" name="Polyfill">Polyfill</h2>
+
+<p>Aquest mètode va ser estandaritzat a la cinquena edició de l'ECMA-262. Els motors que encara no hagin sigut actualitzats per a suportar aquest mètode poden utilitzar el bocí de codi següent per a paliar l'absència d'aquest mètode:</p>
+
+<pre class="brush: js">if (!Date.now) {
+ Date.now = function now() {
+ return new Date().getTime();
+ };
+}
+</pre>
+
+<h2 id="Especificacions">Especificacions</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Especificació</th>
+ <th scope="col">Estat</th>
+ <th scope="col">Comentaris</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.9.4.4', 'Date.now')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Definició inicial. Implementat a JavaScript 1.5.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-date.now', 'Date.now')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilitat_amb_navegadors">Compatibilitat amb navegadors</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Característiques</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Suport bàsic</td>
+ <td>{{CompatChrome("5")}}</td>
+ <td>{{CompatGeckoDesktop("1.9")}}</td>
+ <td>{{CompatIE("9")}}</td>
+ <td>{{CompatOpera("10.50")}}</td>
+ <td>{{CompatSafari("4")}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Característiques</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>
+ <table class="compat-table">
+ <tbody>
+ <tr>
+ <td>Suport bàsic</td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>Basat en la  <a href="http://kangax.github.com/es5-compat-table/">taula de compatibilitat de Kangax</a>.</p>
+
+<h2 id="Vegeu_també">Vegeu també</h2>
+
+<ul>
+ <li>{{domxref("Performance.now()")}} — proporciona marques de temps amb una resolució submilimètrica per a utilitzar al mesurar el rendiment de pàgines web</li>
+ <li>{{domxref("console.time()")}} / {{domxref("console.timeEnd()")}}</li>
+</ul>