Professional Documents
Culture Documents
« new Date » crée et retourne une instance de l’objet Date() avec la date et
l’heure du moment, en appelant son constructeur l’objet-fonction Date().
« Date() » appelle directement la méthode « Date.toString() » [de cet ob-
jet-fonction Date()] avec la date et l’heure du moment. Elle comporte moins
de propriétés que le constructeur « new Date() ».
console.log(new Date())
// Date 2018-12-15T08:39:46.469Z
console.log(Date)
// function Date()
console.log(Date())
// Sat Dec 15 2018 09:39:46 GMT+0100 (heure normale
d’Europe centrale)
</script>
console.log(new Date().getTime())
// 1544863342824
J.D.B. DIASOLUKA Nz. Luyalu JavaScript Tome-II
// console.log(Date.getTime())
// TypeError: Date.getTime is not a function
// console.log(Date().getTime())
// TypeError: Date(...).getTime is not a function
</script>
Date, Date(), new Date, new Date() - 2 / 14 - mardi, 7. mai 2019 (8:40 )
J.D.B. DIASOLUKA Nz. Luyalu JavaScript Tome-II
Avec Firefox :
10:03:19,005 start test.html:3:4
10:03:19,010 Date test.html:5:1
10:03:26,038 Date() test.html:7:1
10:03:27,526 new Date test.html:9:1
10:03:29,032 new Date() test.html:11:1
10:03:30,337 Date.now() test.html:13:1
10:03:31,620 Date.now() test.html:15:1
Avec Yandex :
10:03:43.902 test.html:3 start
10:03:43.925 test.html:5 Date
10:03:49.920 test.html:7 Date()
10:03:50.538 test.html:9 new Date
10:03:51.162 test.html:11 new Date()
10:03:51.544 test.html:13 Date.now()
10:03:51.902 test.html:15 Date.now()
<script>
// Dete et heure en cours.
var auj = new Date();
var mois = auj.getMonth()+1,
jour = auj.getDate(),
an = auj.getFullYear(),
hr = auj.getHours(),
min = auj.getMinutes(),
sec = auj.getSeconds(),
mil = auj.getMilliseconds();
// Manipulation directe de chaque élément de la date.
console.log(jour + '-' + mois + '-' + an+' T '+
hr + ':' + min + ':' + sec + ':' + mil);
console.log(auj.getTime());
// RÉGLER L'ANNÉE.
auj.setFullYear(2920)
// Régler le mois.
auj.setMonth(6) // Les moins vont d'indice 0 (6=7)
Date, Date(), new Date, new Date() - 3 / 14 - mardi, 7. mai 2019 (8:40 )
J.D.B. DIASOLUKA Nz. Luyalu JavaScript Tome-II
// Régler le jour.
auj.setDate(15) // Les moins vont d'indice 0 (6=7)
console.log(auj.toLocaleDateString("fr-Fr")+ " T "+
auj.toLocaleTimeString("fr-Fr"));
console.log(auj.toISOString("fr-Fr"));
// Tous les get ont leurs équivalents set
Date, Date(), new Date, new Date() - 4 / 14 - mardi, 7. mai 2019 (8:40 )
J.D.B. DIASOLUKA Nz. Luyalu JavaScript Tome-II
<script>
var date = new Date(Date.UTC(+002018, 10, 24, 14, 5, 10,
250));
// identique à « var date = (new.Date()).getTime()); »
// console.log((new Date()).getTime());
// console.log((new Date()).getTime());
// console.log((new Date()).valueOf());
var options = {
weekday: "long", year: "numeric", month: "long",
day: "numeric", hour: "2-digit", minute: "2-digit",
second: "2-digit"};
var options2 = {
weekday: "short", year: "numeric", month: "short",
day: "numeric", hour: "2-digit", minute: "2-digit",
second: "2-digit"};
console.log(date.valueOf());
// 1543068310250
console.log(date.valueOf().toLocaleString());
// 1,543,068,310,250
console.log(date.toLocaleString());
// 11/24/2018, 3:05:10 PM
console.log(date.toLocaleString().length); // 22
nsole.log("*".repeat(15));
Date, Date(), new Date, new Date() - 5 / 14 - mardi, 7. mai 2019 (8:40 )
J.D.B. DIASOLUKA Nz. Luyalu JavaScript Tome-II
console.log(date.toLocaleDateString("en-US"));
// 11/24/2018
console.log(date.toLocaleDateString("fr-FR"));
// 24/11/2018
console.log(date.toLocaleDateString("ja-JA"));
// 2018/11/24
console.log(date.toLocaleDateString("en-US", options));
// Saturday, November 24, 2018, 3:05:10 PM
console.log(date.toLocaleDateString("fr-FR", options));
// samedi 24 novembre 2018 à 15:05:10
console.log(date.toLocaleDateString("en-US", options2));
// Sat, Nov 24, 2018, 3:05:10 PM
console.log(date.toLocaleDateString("fr-FR", options2));
// sam. 24 nov. 2018 à 15:05:10
console.log(date.toLocaleDateString("ja-JA", options));
// 2018?11?24???? 15:05:10
console.log(date.toLocaleDateString("ja-JA", options));
// 2018?11?24???? 15:05:10
nsole.log("*".repeat(15));
console.log(date.toLocaleTimeString("en-us"));
// 3:05:10 PM
console.log(date.toLocaleTimeString("fr-FR"));
// 15:05:10
console.log(date.toISOString("fr-FR"));
// 2018-11-24T14:05:10.250Z
console.log(date.toLocaleTimeString("ja-JA"));
// 15:05:10
console.log(date.toLocaleTimeString("en-us", options));
// Saturday, November 24, 2018, 3:05:10 PM
console.log(date.toLocaleTimeString("fr-FR", options));
Date, Date(), new Date, new Date() - 6 / 14 - mardi, 7. mai 2019 (8:40 )
J.D.B. DIASOLUKA Nz. Luyalu JavaScript Tome-II
// samedi 24 novembre 2018 à 15:05:10
console.log(date.toISOString("fr-FR", options));
// 2018-11-24T14:05:10.250Z
console.log(date.toLocaleTimeString("en-us", options2));
// Sat, Nov 24, 2018, 3:05:10 PM
console.log(date.toLocaleTimeString("fr-FR", options2));
// sam. 24 nov. 2018 à 15:05:10
console.log(date.toLocaleTimeString("ja-JA", options2));
// 2018?11?24?(?) 15:05:10
console.log(date.toLocaleTimeString("ja-JA", options2));
// 2018?11?24?(?) 15:05:10
</script>
I. Date :
prototype: {…}
constructor: function Date()
getDate: function getDate()
Date, Date(), new Date, new Date() - 7 / 14 - mardi, 7. mai 2019 (8:40 )
J.D.B. DIASOLUKA Nz. Luyalu JavaScript Tome-II
getDay: function getDay()
getFullYear: function getFullYear()
getHours: function getHours()
getMilliseconds: function getMilliseconds()
getMinutes: function getMinutes()
getMonth: function getMonth()
getSeconds: function getSeconds()
getTime: function getTime()
getTimezoneOffset: function getTimezoneOffset()
getUTCDate: function getUTCDate()
getUTCDay: function getUTCDay()
getUTCFullYear: function getUTCFullYear()
getUTCHours: function getUTCHours()
getUTCMilliseconds: function getUTCMilliseconds()
getUTCMinutes: function getUTCMinutes()
getUTCMonth: function getUTCMonth()
getUTCSeconds: function getUTCSeconds()
getYear: function getYear()
setDate: function setDate()
setFullYear: function setFullYear()
setHours: function setHours()
setMilliseconds: function setMilliseconds()
setMinutes: function setMinutes()
setMonth: function setMonth()
setSeconds: function setSeconds()
setTime: function setTime()
setUTCDate: function setUTCDate()
setUTCFullYear: function setUTCFullYear()
setUTCHours: function setUTCHours()
setUTCMilliseconds: function setUTCMilliseconds()
setUTCMinutes: function setUTCMinutes()
setUTCMonth: function setUTCMonth()
setUTCSeconds: function setUTCSeconds()
setYear: function setYear()
toDateString: function toDateString()
toGMTString: function toUTCString()
toISOString: function toISOString()
Date, Date(), new Date, new Date() - 8 / 14 - mardi, 7. mai 2019 (8:40 )
J.D.B. DIASOLUKA Nz. Luyalu JavaScript Tome-II
toJSON: function toJSON()
toLocaleDateString: function toLocaleDateString()
toLocaleString: function toLocaleString()
toLocaleTimeString: function toLocaleTimeString()
toSource: function toSource()
toString: function toString()
toTimeString: function toTimeString()
toUTCString: function toUTCString()
valueOf: function valueOf()
Symbol(Symbol.toPrimitive): function Symbol.toPrimitive()
<prototype>: Object { … }
<prototype>: ()
apply: function apply()
arguments:
bind: function bind()
call: function call()
caller:
constructor: function Function()
length: 0
name: ""
toSource: function toSource()
toString: function toString()
Symbol(Symbol.hasInstance): function Symbol.hasInstance()
<get arguments()>: function arguments()
<set arguments()>: function arguments()
<get caller()>: function caller()
<set caller()>: function caller()
<prototype>: {…}
__defineGetter__: function __defineGetter__()
__defineSetter__: function __defineSetter__()
__lookupGetter__: function __lookupGetter__()
__lookupSetter__: function __lookupSetter__()
__proto__:
constructor: function Object()
hasOwnProperty: function hasOwnProperty()
isPrototypeOf: function isPrototypeOf()
Date, Date(), new Date, new Date() - 9 / 14 - mardi, 7. mai 2019 (8:40 )
J.D.B. DIASOLUKA Nz. Luyalu JavaScript Tome-II
propertyIsEnumerable: function propertyIsEnumerable()
toLocaleString: function toLocaleString()
toSource: function toSource()
toString: function toString()
valueOf: function valueOf()
<get __proto__()>: function __proto__()
<set __proto__()>: function __proto__()
III. Date() :
Date, Date(), new Date, new Date() - 10 / 14 - mardi, 7. mai 2019 (8:40 )
J.D.B. DIASOLUKA Nz. Luyalu JavaScript Tome-II
Mots-clés :
Date, Date(), new Date, new Date() - 11 / 14 - mardi, 7. mai 2019 (8:40 )
J.D.B. DIASOLUKA Nz. Luyalu JavaScript Tome-II
DIASOLUKA Nz. Luyalu
Docteur en Médecine, Chirurgie & Accouchements (1977),
CNOM : 0866 - Spécialiste en ophtalmologie (1980)
Études humanités : Scientifique - Mathématiques & Physique.
Informaticien-amateur, Programmeur et WebMaster.
diasfb@mail2world.com
Autre Lecture :
https://www.scribd.com/document/374738470/Le-Plus-Grand-Secret-de-La-
Creation
• https://www.scribd.com/document/377036251/Le-
Dosage-Des-Medicaments-en-Cac-Cas
• https://www.scribd.com/document/377035454/Le-
Hasard-Des-Thermometres-Non-contact-a-Infrarouge
• https://www.scribd.com/document/376222482/Petite-
Introduction-Aux-Fonctions-JavaScript
Date, Date(), new Date, new Date() - 12 / 14 - mardi, 7. mai 2019 (8:40 )
J.D.B. DIASOLUKA Nz. Luyalu JavaScript Tome-II
• https://www.scribd.com/document/376221919/La-Foi-
en-Jesus-Christ-Pour-Quoi-Faire
• https://www.scribd.com/document/375689778/Lacuite-
visuelle-angulaire
• https://www.scribd.com/document/375349851/La-
variable-This
•
https://www.scribd.com/document/375024162/Fonctions-
Imbriquees-en-JS
• https://www.scribd.com/document/374789297/Format-
Interne-Des-Objets-JavaScript
•
https://www.scribd.com/document/374788758/Iterations-
en-JavaScript
• https://www.scribd.com/document/374738470/Le-Plus-
Grand-Secret-de-La-Creation
• https://www.scribd.com/document/374597969/Nouvelle-
Formule-d-IMC-indice-de-doduite-Selon-Dr-Diasoluka
• https://www.scribd.com/document/373847209/Property-
Descriptors
• https://www.scribd.com/document/373833282/l-Objet-
Global-Window
•
https://www.scribd.com/document/372665249/Javascript-
Tome-II
• https://www.scribd.com/document/355291488/motilite-
oculaire-2
• https://www.scribd.com/document/355291239/motilite-
oculaire-I
Date, Date(), new Date, new Date() - 13 / 14 - mardi, 7. mai 2019 (8:40 )
J.D.B. DIASOLUKA Nz. Luyalu JavaScript Tome-II
• https://www.scribd.com/document/355290248/Script-d-
Analyses-Des-Reflexes-Pupillomoteurs
•
https://www.scribd.com/document/321168468/Renseigne
ments-Id-et-Anthropometriques
•
https://www.scribd.com/document/320856721/Emission-
31-Jul-2016
•
https://www.scribd.com/document/318182982/Complicati
on-Visuelle-du-Traitement-de-La-Malaria
• https://www.scribd.com/document/318180637/Rapport-
Entre-Oxymetrie-Et-Type-Respiration
•
https://www.scribd.com/document/315746265/Classificati
on-Des-Medicaments
•
https://www.scribd.com/document/315745909/Incongruen
ces-Heresies-et-Heterodoxies-de-la-Notion-de-
Laboratoire
• https://www.scribd.com/document/315745725/Rapport-
Entre-Oxymetrie-Et-Type-Respiration
Date, Date(), new Date, new Date() - 14 / 14 - mardi, 7. mai 2019 (8:40 )