Javascript (9) - Objet Date

20 Jan 2019 · 10 min
10:03

In this French‑language tutorial, the presenter walks through the JavaScript Date object from creation to practical use. He first shows how to instantiate a Date with the default constructor, emphasizing the need to capitalize the constructor. He then demonstrates how to extract each component of a date using the various getter methods, pointing out quirks such as getYear returning a two‑digit offset, the zero‑based month index, and the numeric day‑of‑week mapping. The lesson explains the Unix timestamp returned by getTime, how it represents milliseconds since 1 January 1970, and why it is useful for arithmetic on dates (e.g., calculating hotel night‑stays). Next, he shows how to build a Date for a specific moment by passing year, month, day, and optionally hour/minute/second/millisecond to the constructor, again stressing the month‑zero indexing. Finally, he creates a live digital clock in the browser: a recursive setTimeout loop that rebuilds a Date each second, extracts hours/minutes/seconds, formats them with leading zeros, makes the colon separator blink by toggling it on even/odd seconds, and applies a monospace font to prevent layout shift. The tutorial ends with a brief recap and invitation to the next video.

Chapters

More from Yamossoun

8:56
youtube.com

Compteur synchrone - Logique séquentielle

2w ago
11:58
youtube.com

Compteur asynchrone et diviseur de fréquence - Logique séquentielle

3w ago
11:37
youtube.com

Les registres (parallèle et à décalage) - Logique séquentielle

1mo ago
6:14
youtube.com

Bascule T (Toggle) - Logique séquentielle

1mo ago
12:05
youtube.com

Bascule JK - Logique séquentielle

1mo ago
9:17
youtube.com

Bascule D flip-flop active sur front montant - Logique séquentielle

1mo ago
10:08
youtube.com

Bascule D Latch - Logique séquentielle

1mo ago
8:13
youtube.com

Bascule RS - Logique séquentielle

1mo ago
5:04
youtube.com

Logique séquentielle - Introduction

2mo ago
1:15
youtube.com

Le codeur - Logique combinatoire #codeur #logique #circuit #booleanlogic

2mo ago
1:56
youtube.com

Algorithme de calcule de la racine carrée par dichotomie #dichotomy #squareroot #algorithm

3mo ago
See all content