Date Object in JavaScript Object


In C-SharpCorner Delhi Chapter meet up we enjoyed JavaScript with Fun and Knowledge. There was a lot of knowledge with C-Sharp Corner Team. Here they covered many topics of JavaScript Like Object, Array, function, methods with live practical. In front of 120+ audiences, Speaker was Dhananjay Kumar, Brij Mishra, and Suchit Khanna. Here you can learn JavaScript next and next to next month too, So stay tune with C-SharpCorner Updates.
After learning a lot more Now Let's Start a new topic: Date objects in JavaScript Objects.
The object is used to display a date on a web page or timestamp in numerical or in any mathematical calculation. In JavaScript, we can either define the Date object by providing the date of our choice or let JavaScript define the Date object based on the visitor's System clock. The Date object stores date as milliseconds that have passed since midnight on January 1, 1970, Universal Time Code(UTC). The Date object can represent dates before 285,616 years before or after January 1, 1970. The Date object can be created with the help of the constructor function.
We can follow the given Syntax for making a Data object. : 
We can follow these above lines for making a Date object.
There are two properties of the Date object :
And Many methods (Like- getDate(), getDay(), getUTCDate(), Parse(), setMonth(), UTC(), valueOf()………..Etc) are in JavaScript.
Now let's do an example:
Print the Date and Time of your own System. Follow the given Code-
Script is given in the Red Box. In the given, Code Data object name mydate is created by using the new keyword. The date is fetched by using three methods: getDate(), getMonth() and getFullyear(). The getDate() method retrieves the current date of the month. The getMonth() retrieves the current numerical equivalence of the month,  Which in
  • 0 for January
  •   1 for February,
  •   2 for March
  •   4 for March and Similar for Others.
The getFullYear() method is used to get the current year.
The current time is retrieved by three methods getHours(), getMinutes() and getSeconds(). The getHours() method is used to retrieve the current hour, which comes in the range 0 t0 23. The getMinutes() method is used to retrieve the current minute that ranges from o to 59. The getSeconds() method is used to retrieve the second of the current time that ranges from 0 to 59.
Now let's see the output of the given Code for My System:
Do more Exercise, be more perfect.