Date Formatting in Apex

Here’s a quick cheat sheet on displaying dates and date info via Apex.  In this example I’ll use system date for “right now”…but you can do this with any instance of the Date class.

Day of the week:

system.now().date().format(‘EEEE’);

Month of the year:

system.now().date().format(‘MMMMM’);

Year-Month-Day:

string.valueof(system.now().date())

Month/Day/Year:

system.now().date().format()

 

***You can find additional examples here: Java SimpleDateFormat

Salesforce Developer Evangelist

Absolutely fantastic post by our friend Brian Kwong, aka the “Salesforce Wizard”, on the Salesforce Developer Evangelist group.  This is such a great group to be plugged into to see what they are discussion and the content they push out each month.

Make sure you check out the links Brian provides for the developer blogs and twitter accounts.

Again here’s the link: Salesforce Developer Evangelist – Some of My Favorite People