You need to sign in to do that
Don't have an account?
johnn dev
how to get data and month from a salesforce field
how to get data and month from a salesforce field
EXAMPLE: I need to get month and day from the "date" field, but the date field is filled with day/month/year example 05/15/2022. but I just want it to return the day and month from this field and I don't want it to return the year what is the formula for this apex class
Hi Johnn,
If you want to use the logic in apex class then use this way :-
Integer dtMonth = c.Contract_Start_Date__c.month();
The method ".month()" returns an integer, so if your date is 11/11/2012, it will return you '11'. To get the Month Name, write some logic that returns you the month name when you pass the month number to it.
If this help, please mark it as best answer so that it can help others.
Regards,
Priya Ranjan
Salesforce