aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/global_objects/date/toisostring
diff options
context:
space:
mode:
authorjulieng <julien.gattelier@gmail.com>2021-08-03 08:03:23 +0200
committerSphinxKnight <SphinxKnight@users.noreply.github.com>2021-09-03 08:08:25 +0200
commitbf8e099b9c8b3c60d60b3712b4fc97b052c39887 (patch)
treec101746d082c9581c94f5937519c7d0e2f4af8cb /files/fr/web/javascript/reference/global_objects/date/toisostring
parent844f5103992238c0c23203286dad16a466e89c97 (diff)
downloadtranslated-content-bf8e099b9c8b3c60d60b3712b4fc97b052c39887.tar.gz
translated-content-bf8e099b9c8b3c60d60b3712b4fc97b052c39887.tar.bz2
translated-content-bf8e099b9c8b3c60d60b3712b4fc97b052c39887.zip
convert content to md
Diffstat (limited to 'files/fr/web/javascript/reference/global_objects/date/toisostring')
-rw-r--r--files/fr/web/javascript/reference/global_objects/date/toisostring/index.md94
1 files changed, 38 insertions, 56 deletions
diff --git a/files/fr/web/javascript/reference/global_objects/date/toisostring/index.md b/files/fr/web/javascript/reference/global_objects/date/toisostring/index.md
index 102c8dfb19..04e1ce306e 100644
--- a/files/fr/web/javascript/reference/global_objects/date/toisostring/index.md
+++ b/files/fr/web/javascript/reference/global_objects/date/toisostring/index.md
@@ -11,40 +11,42 @@ tags:
translation_of: Web/JavaScript/Reference/Global_Objects/Date/toISOString
original_slug: Web/JavaScript/Reference/Objets_globaux/Date/toISOString
---
-<div>{{JSRef}}</div>
+{{JSRef}}
-<p>La méthode <code><strong>toISOString()</strong></code> renvoie une chaîne de caractères au format ISO (<a href="http://en.wikipedia.org/wiki/ISO_8601">ISO 8601 Extended Format</a>), qui peut être décrite de cette façon : <code><strong>YYYY-MM-DDTHH:mm:ss.sssZ</strong></code> (toujours longue de 24 caractères) ou de cette façon <strong><code>±YYYYYY-MM-DDTHH:mm:ss.sssZ</code></strong> (27 caractères). Le fuseau horaire est toujours UTC, comme l'indique le suffixe « Z » (pour zéro décalage avec UTC).</p>
+La méthode **`toISOString()`** renvoie une chaîne de caractères au format ISO ([ISO 8601 Extended Format](http://en.wikipedia.org/wiki/ISO_8601)), qui peut être décrite de cette façon : **`YYYY-MM-DDTHH:mm:ss.sssZ`** (toujours longue de 24 caractères) ou de cette façon **`±YYYYYY-MM-DDTHH:mm:ss.sssZ`** (27 caractères). Le fuseau horaire est toujours UTC, comme l'indique le suffixe « Z » (pour zéro décalage avec UTC).
-<div>{{EmbedInteractiveExample("pages/js/date-toisostring.html")}}</div>
+{{EmbedInteractiveExample("pages/js/date-toisostring.html")}}
-<h2 id="Syntaxe">Syntaxe</h2>
+## Syntaxe
-<pre class="syntaxbox"><var>dateObj</var>.toISOString()</pre>
+ dateObj.toISOString()
-<h3 id="Valeur_de_retour">Valeur de retour</h3>
+### Valeur de retour
-<p>Une chaîne de caractères représentant la date indiquée au format <a href="https://fr.wikipedia.org/wiki/ISO_8601">ISO 8601</a> selon le temps universel.</p>
+Une chaîne de caractères représentant la date indiquée au format [ISO 8601](https://fr.wikipedia.org/wiki/ISO_8601) selon le temps universel.
-<h2 id="Exemples">Exemples</h2>
+## Exemples
-<h3 id="Utiliser_toISOString()">Utiliser <code>toISOString()</code></h3>
+### Utiliser `toISOString()`
-<pre class="brush: js">var aujourdhui = new Date("05 October 2011 14:48 UTC");
+```js
+var aujourdhui = new Date("05 October 2011 14:48 UTC");
console.log(aujourdhui.toISOString()); // Renvoie "2011-10-05T14:48:00.000Z"
-</pre>
+```
-<p>L'exemple ci-dessus analyse une chaîne de caractères non-standard, qui peut donc être incorrectement intérprété par des navigateurs n'utilisant pas Gecko.</p>
+L'exemple ci-dessus analyse une chaîne de caractères non-standard, qui peut donc être incorrectement intérprété par des navigateurs n'utilisant pas Gecko.
-<h2 id="Prothèse_d'émulation_(polyfill)">Prothèse d'émulation (<em>polyfill</em>)</h2>
+## Prothèse d'émulation (_polyfill_)
-<p>Cette méthode fut standardisée avec la cinquième édition d'ECMAScript. Afin d'utiliser cette méthode avec les moteurs qui n'en disposent pas nativement, on pourra utiliser ce fragment de code :</p>
+Cette méthode fut standardisée avec la cinquième édition d'ECMAScript. Afin d'utiliser cette méthode avec les moteurs qui n'en disposent pas nativement, on pourra utiliser ce fragment de code :
-<pre class="brush:js">if ( !Date.prototype.toISOString ) {
+```js
+if ( !Date.prototype.toISOString ) {
( function() {
function pad(number) {
- if ( number &lt; 10 ) {
+ if ( number < 10 ) {
return '0' + number;
}
return number;
@@ -62,43 +64,23 @@ console.log(aujourdhui.toISOString()); // Renvoie "2011-10-05T14:48:00.000Z"
};
}() );
-}</pre>
-
-<h2 id="Spécifications">Spécifications</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">Spécification</th>
- <th scope="col">État</th>
- <th scope="col">Commentaires</th>
- </tr>
- <tr>
- <td>{{SpecName('ES5.1', '#sec-15.9.5.43', 'Date.prototype.toISOString')}}</td>
- <td>{{Spec2('ES5.1')}}</td>
- <td>Définition initiale. Implémentée avec JavaScript 1.8.</td>
- </tr>
- <tr>
- <td>{{SpecName('ES6', '#sec-date.prototype.toisostring', 'Date.prototype.toISOString')}}</td>
- <td>{{Spec2('ES6')}}</td>
- <td> </td>
- </tr>
- <tr>
- <td>{{SpecName('ESDraft', '#sec-date.prototype.toisostring', 'Date.prototype.toISOString')}}</td>
- <td>{{Spec2('ESDraft')}}</td>
- <td> </td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>
-
-<p>{{Compat("javascript.builtins.Date.toISOString")}}</p>
-
-<h2 id="Voir_aussi">Voir aussi</h2>
-
-<ul>
- <li>{{jsxref("Date.prototype.toLocaleDateString()")}}</li>
- <li>{{jsxref("Date.prototype.toTimeString()")}}</li>
- <li>{{jsxref("Date.prototype.toUTCString()")}}</li>
-</ul>
+}
+```
+
+## Spécifications
+
+| Spécification | État | Commentaires |
+| -------------------------------------------------------------------------------------------------------------------- | ---------------------------- | ----------------------------------------------------- |
+| {{SpecName('ES5.1', '#sec-15.9.5.43', 'Date.prototype.toISOString')}} | {{Spec2('ES5.1')}} | Définition initiale. Implémentée avec JavaScript 1.8. |
+| {{SpecName('ES6', '#sec-date.prototype.toisostring', 'Date.prototype.toISOString')}} | {{Spec2('ES6')}} |   |
+| {{SpecName('ESDraft', '#sec-date.prototype.toisostring', 'Date.prototype.toISOString')}} | {{Spec2('ESDraft')}} |   |
+
+## Compatibilité des navigateurs
+
+{{Compat("javascript.builtins.Date.toISOString")}}
+
+## Voir aussi
+
+- {{jsxref("Date.prototype.toLocaleDateString()")}}
+- {{jsxref("Date.prototype.toTimeString()")}}
+- {{jsxref("Date.prototype.toUTCString()")}}