Sunday, December 18, 2022

Retrieving month value from date field in apex class/Trigger

 Retrieving month value from date field in apex class/Trigger

In two ways we can capture month value from date field:


date_fieldname__c.month() 

Which returns 1,2,3.... integer values

string.valueof(date_fieldname__c).substring(5,7)

Which return '01','02','03'.... string values

No comments:

Post a Comment

Understanding Wire vs Imperative Apex Method Calls in Salesforce Lightning Web Components (LWC)

Understanding Wire vs Imperative Apex Method Calls in Salesforce Lightning Web Components (LWC) Introduction: Salesforce Lightning Web ...