js get first and last day of previous month

Solutions on MaxInterview for js get first and last day of previous month by the best coders in the world

showing results for - "js get first and last day of previous month"
Samantha
03 Aug 2017
1var d = new Date();
2d.setDate(0); //sets d to the last day of the previous month
3d.setDate(1); //sets d the the first day of that month
4d.setHours(0,0,0,0); //sets d time to midnight
5
6//d now equals the first day of the month before today      
similar questions