0

Any assistance would be much appreciated!

Looking to build a formula field that extracts Month and Year of a custom date field. (if it is 28.09.2020 as the date then the formula field would display September 2020)

2 Answers 2

1

You can try the below formula. based on your date field you have to use "If" to do null check.

Best resources for building formulas https://help.salesforce.com/articleView?id=customize_functions.htm&type=5

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")  & " " &  TEXT(Year(DATEVALUE(CreatedDate)))
0

As mentioned in this question you can try below code as it shows in the required format:

<apex:outputText value="{0, date, MMMM d','  yyyy}">
<apex:param value="{!NOW()}" />
</apex:outputText>

Have a look at the JavaDocs for SimpleDateFormat for the various date formats.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .