aboutsummaryrefslogtreecommitdiff
path: root/files/ca/web/javascript/referencia/objectes_globals/date/settime
diff options
context:
space:
mode:
Diffstat (limited to 'files/ca/web/javascript/referencia/objectes_globals/date/settime')
-rw-r--r--files/ca/web/javascript/referencia/objectes_globals/date/settime/index.html118
1 files changed, 118 insertions, 0 deletions
diff --git a/files/ca/web/javascript/referencia/objectes_globals/date/settime/index.html b/files/ca/web/javascript/referencia/objectes_globals/date/settime/index.html
new file mode 100644
index 0000000000..9774f3ee4c
--- /dev/null
+++ b/files/ca/web/javascript/referencia/objectes_globals/date/settime/index.html
@@ -0,0 +1,118 @@
+---
+title: Date.prototype.setTime()
+slug: Web/JavaScript/Referencia/Objectes_globals/Date/setTime
+translation_of: Web/JavaScript/Reference/Global_Objects/Date/setTime
+---
+<div>{{JSRef}}</div>
+
+<p>El mètode <strong><code>setTime()</code></strong> configura l'objecte {{jsxref("Date")}} amb un nombre que representa un temps en milisegons que han passat des de la mitjanit de l'ú de gener de 1970, en temps universal.</p>
+
+<h2 id="Sintaxi">Sintaxi</h2>
+
+<pre class="syntaxbox"><code><var>objecteData</var>.setTime(temps)</code></pre>
+
+<h3 id="Paràmetres">Paràmetres</h3>
+
+<dl>
+ <dt><code>temps</code></dt>
+ <dd>Un nombre sencer que representa el nombre de milisegons que han passat des de l'1 de gener de 1970 00:00:00 UTC.</dd>
+</dl>
+
+<h2 id="Descripció">Descripció</h2>
+
+<p>Utilitzeu el mètode <code>setTime()</code> per a assignar una data i hora a un objecte de tipus {{jsxref("Date")}}.</p>
+
+<h2 id="Exemples">Exemples</h2>
+
+<h3 id="Utilitzar_setTime()">Utilitzar <code>setTime()</code></h3>
+
+<pre class="brush: js">var elGranDia = new Date('July 1, 1999');
+var elMateixGranDia = new Date();
+elMateixGranDia.setTime(elGranDia.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('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Definició inicial. Implementat a JavaScript 1.0.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.9.5.27', 'Date.prototype.setTime')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-date.prototype.settime', 'Date.prototype.setTime')}}</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ística</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>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Característica</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>Suport bàsic</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="Vegeu_també">Vegeu també</h2>
+
+<ul>
+ <li>{{jsxref("Date.prototype.getTime()")}}</li>
+ <li>{{jsxref("Date.prototype.setUTCHours()")}}</li>
+</ul>