From 39f2114f9797eb51994966c6bb8ff1814c9a4da8 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 12:36:08 +0100 Subject: unslug fr: move --- .../global_objects/date/valueof/index.html | 87 ++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 files/fr/web/javascript/reference/global_objects/date/valueof/index.html (limited to 'files/fr/web/javascript/reference/global_objects/date/valueof') diff --git a/files/fr/web/javascript/reference/global_objects/date/valueof/index.html b/files/fr/web/javascript/reference/global_objects/date/valueof/index.html new file mode 100644 index 0000000000..680f34b4a1 --- /dev/null +++ b/files/fr/web/javascript/reference/global_objects/date/valueof/index.html @@ -0,0 +1,87 @@ +--- +title: Date.prototype.valueOf() +slug: Web/JavaScript/Reference/Objets_globaux/Date/valueOF +tags: + - Date + - JavaScript + - Méthode + - Prototype + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Date/valueOf +--- +
{{JSRef}}
+ +

La méthode valueOf() renvoie la valeur primitive d'un objet {{jsxref("Date")}}.

+ +
{{EmbedInteractiveExample("pages/js/date-valueof.html")}}
+ + + +

Syntaxe

+ +
date.valueOf()
+ +

Valeur de retour

+ +

Le nombre de millisecondes écoulées entre le premier janvier 1970, minuit UTC et la date indiquée.

+ +

Description

+ +

La méthode valueOf() renvoie la valeur primitive d'un objet Date sous forme d'un nombre. Ce nombre correspond au nombre de millisecondes écoulées depuis le 1 janvier 1970 00h00 GMT.

+ +

D'un point de vue fonctionnel, cette méthode est équivalente à {{jsxref("Date.prototype.getTime()")}}.

+ +

Cette méthode est souvent appelée en interne par le moteur JavaScript et n'est pas utilisée de façon explicite dans des scripts.

+ +

Exemples

+ +

Utiliser valueOf()

+ +
var x = new Date(56, 6, 17);
+var maVar = x.valueOf();      // maVar vaut -424713600000
+
+ +

Spécifications

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SpécificationÉtatCommentaires
{{SpecName('ES1')}}{{Spec2('ES1')}}Définition initiale. Implémentée avec JavaScript 1.1.
{{SpecName('ES5.1', '#sec-15.9.5.8', 'Date.prototype.valueOf')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.valueof', 'Date.prototype.valueOf')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-date.prototype.valueof', 'Date.prototype.valueOf')}}{{Spec2('ESDraft')}} 
+ +

Compatibilité des navigateurs

+ + + +

{{Compat("javascript.builtins.Date.valueOf")}}

+ +

Voir aussi

+ + -- cgit v1.2.3-54-g00ecf