Question: What is Date class in Javascript? Please explain.Answer: to create a Date object, use new & supply year/month/day/… as desiredtoday = new Date(); // sets to current date & time newYear = new Date(2002,0,1); //sets to Jan 1, 2002 12:00AM methods include: newYear.getYear() can access individual components of a date newYear.getMonth() newYear.getDay() newYear.getHours() newYear.getMinutes() newYear.getSeconds() newYear.getMilliseconds() |
Is it helpful?
Yes
No
Most helpful rated by users:
- What are JavaScript data types?
- What\'s relationship between JavaScript and ECMAScript?
- What does isNaN function do?
- How do you convert numbers between different bases in JavaScript?
- What is negative infinity?