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 | Lightning Champion | 17x Salesforce Certified | Application Architect | 7x Trailhead Ranger | Techforce Services | Australia

Leave a Reply

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

*