- var date = new Date();
The following are the Date Objects method. We will work only with the date.
- var month = date.getMonth();
Returns the month from 0 to 11.
- var day = date.getDate();
It will return the day of the month.
- var year = date.getFullYear();
It returns the 4 digit year.
After the get word of the date object is always a capital letter or else it will not work.
Now, let's get the day of the week.
- var getday = date.getDay();
This will return the number from 0 which represents Sunday and 1 is Monday, so on. In order for us to get the name of the weekday, we have put them in an array.
- var weekday = new Array(7);
- weekday = "Sunday";
- weekday = "Monday";
- weekday = "Tuesday";
- weekday = "Wednesday";
- weekday = "Thursday";
- weekday = "Friday";
- weekday = "Saturday";
- var getday = weekday[date.getDay()];
Hope you learn from this.
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.