[SalesForce] How to calculate the start date and end date of next week based on current date in apex

Formula to get the start date and end date of next week based on current date in apex.

Best Answer

I don't think there is direct way. But you can do this.

date myDate = date.today();
date weekStart = myDate.toStartofWeek();
system.debug(weekStart.addDays(7) );

It will return the start of the week for the Date that called the method, depending on the context user's locale. example, the start of a week is Sunday in the United States locale, and Monday in European locales.

Related Topic