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)
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityAny 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)
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)))
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.