How to get start date and end date last month using Javascripts?

How to get start date and end date last month using Javascripts.

Example:

Today - 07/09/2013

I need to get a conclusion

Last month start date: 06/01/2013 Last end date: 06/30/2013

+4
source share
1 answer
function f() { var date = new Date(); var firstDay = new Date(date.getFullYear(), date.getMonth()-1, 1); var lastDay = new Date(date.getFullYear(), date.getMonth(), 0); alert(firstDay+"==="+lastDay); } 
+5
source

Source: https://habr.com/ru/post/1490425/


All Articles