Flussdiagramm
The Date Object
Inhalt des Flussdiagramms
JavaScript Date Object
The Date Object
The Date object is a native object that is being provided to us by JavaScript in order to perform any operations that deal with dates. Booking applications for hotels, flights or events deal with the date object to provide their exmperience/
In order to start working with dates you need to create a new date object. This is done by the date constructor.
let today = new Date(); //Beware if no parameters are passed to the constructor then the date is the exact date of now, the date that the script executed itself and especially this line.
You can also pass a specified date by passing either arguments inside the Date constructor or a string. For all the possible ways to create a new date please reference the links below:
Create date object possible methods.
Create date objects by passing a human readable string.
In order to access information from a date object you must use one of the native date 'getter' methods like:
console.log(today.getFullYear()) // this returns 2018 as a number.
See all getter functions for retrieving information from a date object here!
In order to change a specific part of a date object we use a list of functions that are provided to us, the so called 'setter' date functions.
let todayNextMonth = new Date();
todayNextMonth.setMonth(today.getMonth() + 1); // this will set the month onto the next month from today. Today is 15th October, this will set the date to 15th Nov 2018.
Check full docs for setter functions and how to change specific piece of info here!
c
/
Informationen
- Beschreibung
- Junior Certificate Web Developing Flussdiagramm am The Date Object, erstellt von Kostas Diakogiannis am 15/10/2018.
- Erstellt von
- Kostas Diakogiannis
- Aufrufe
- 3
- Verlauf
-
- Erstellt von Kostas Diakogiannis · 12 Okt 2018
- Kopiert von Kostas Diakogiannis · 12 Okt 2018
- Kopiert von Kostas Diakogiannis · 12 Okt 2018
- Kopiert von Kostas Diakogiannis · 15 Okt 2018
- Kopiert von Kostas Diakogiannis · 15 Okt 2018
- Bewertung