function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
The new LearnerThe new Learner 

How to calculate the date of current week

Hi Experts,

I need to calculate the Date of current week in apex class, i have two fields preferred date and WeekDate field , eg: when  'Preferred Day(picklist list field)” = Monday so i need to set to the date for the "WeekDate" field  to  Monday of this week like wise i need to do till friday. if Preferred Day value is none then i need to populate todays date for the WeekDate field.

Thanks indavance
HARSHIL U PARIKHHARSHIL U PARIKH
This is tricky though. What happens if user changes the weekday after few months of creation of record. It would be challenging to auto populate a date for that weekday. However, you can other way if you would like. Auto populating weekday based on date.

check this out: https://success.salesforce.com/answers?id=90630000000h1oXAAQ
The new LearnerThe new Learner
He can't change that date, can you provide me that logic pls