How could I get the day of my current date, so I get my current date:
$scope.CurrentDate = new Date();
But the day how do I get it?
How could I get the day of my current date, so I get my current date:
$scope.CurrentDate = new Date();
But the day how do I get it?
Use the% %%% JavaScript function.
var dateDay = new Date().getDay();
One way would be through pure javascript:
To return, for example, the name from the number:
function getDia(index){
var dia = new Array(7);
dia[0] = "Domingo";
dia[1] = "Lunes";
dia[2] = "Martes";
dia[3] = "Miércoles";
dia[4] = "Jueves";
dia[5] = "Viernes";
dia[6] = "Sábado";
return dia[index];
}
To use it
var d = new Date(); // Por ejemplo 1
var n = getDia(d.getDay());
The result:
Monday
And to get the number of the day the getDate () method is used.
d.getDate() // Por ej: 22
Example: link
I hope that is what you are looking for, but, do not hesitate to ask again. Greetings