How To get Day, Month and Year values using Apex Class in Salesforce

Use the Following code to get the Day, Month and Year values using Apex Class

Integer d = Date.Today().Day();
Integer m = Date.Today().Month();
Integer y = Date.Today().Year();
system.debug(‘Day::’+d);
system.debug(‘Month::’+m);
system.debug(‘Year::’+y);

Output:

SFDC Learn & Share!!
Happy to Coding!

Written by 

Salesforce MVP | 15x Salesforce Certified | Lightning Champion | Application Architect | 6x Trailhead Ranger | Sydney | Australia

Leave a Reply

Your email address will not be published. Required fields are marked *

*