get current day javascript code example
Example 1: how to use current data in javascript
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
Example 2: get day js
switch (new Date().getDay()) {
case 0:
day = "Sunday";
break;
case 1:
day = "Monday";
break;
case 2:
day = "Tuesday";
break;
case 3:
day = "Wednesday";
break;
case 4:
day = "Thursday";
break;
case 5:
day = "Friday";
break;
case 6:
day = "Saturday";
}
Example 3: javascript get date
let date = new Date();
let string = date.toString();
Example 4: javascript get current day of month
new Date().getDate();
Example 5: javascript get day
var d = new Date();
var n = d.getDay();
Example 6: calculate today date javascript
var today = new Date();