Home SALESFORCEAPEX How to Display Month Name based on Created Date Field using Salesforce Formula

How to Display Month Name based on (Created Date) DateTime Field using Salesforce Formula

Below is the steps to achieve the Month Name display based on the Date field from salesforce Case object.

Step1:
Create a New Custom Formula field under CASE Object – Month of Creation

Step2:
Return Formula type should be ‘String’ (Text);

Step3:
Copy and Paste the below code into the Formula Text area box.

Here used CreatedDate – DateTime Field, so converted DATEVALUE

CASE(MONTH( DATEVALUE( CreatedDate )),
1, ‘January’,
2, ‘February’,
3, ‘March’,
4, ‘April’,
5, ‘May’,
6, ‘June’,
7, ‘July’,
8, ‘August’,
9, ‘September’,
10, ‘October’,
11, ‘November’,
12, ‘December’,
‘None’)

Step4:
‘CreatedDate’ is currently DateTime Fields, so first convert from datetime to date using DATEVALUE.

Month of Creation filed now appear based on the CreatedDate field from Case Object.
Ex: 06/03/2013 14:46
Then Value should appear like  “March”.

 

Another Example:

How to Display Month Name based on Date Custom Field using Salesforce Formula

CASE( MONTH( Invoice_Date__c ) ,
1, ‘January’,
2, ‘February’,
3, ‘March’,
4, ‘April’,
5, ‘May’,
6, ‘June’,
7, ‘July’,
8, ‘August’,
9, ‘September’,
10, ‘October’,
11, ‘November’,
12, ‘December’,
‘None’)

Here Invoice_Date__c  is a Date Field.

 

You may also like

Leave a Comment