Date today = Date.today();
Date firstDayOfCurrentMonth = today.toStartOfMonth();
Date lastMonthFirstDay = firstDayOfCurrentMonth.addMonths(-1);
Date lastMonthLastDay = firstDayOfCurrentMonth.addDays(-1);
System.debug('First day of last month: ' + lastMonthFirstDay);
System.debug('Last day of last month: ' + lastMonthLastDay);
09-06
807
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-15
1642
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-11
09-11
09-11