“Obtenga el primer día y el último día de Mongth JavaScript actual” Código de respuesta

Obtenga el primer día y el último día de Mongth JavaScript actual

var date = new Date();
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
HossAzadi

JS consigue el primer y último día del mes anterior

var d = new Date();
d.setDate(0); //sets d to the last day of the previous month
d.setDate(1); //sets d the the first day of that month
d.setHours(0,0,0,0); //sets d time to midnight

//d now equals the first day of the month before today      
Lazy Lemur

Respuestas similares a “Obtenga el primer día y el último día de Mongth JavaScript actual”

Preguntas similares a “Obtenga el primer día y el último día de Mongth JavaScript actual”

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código