You need to sign in to do that
Don't have an account?
netTrekker_AD
Getting text name of Month out of a Date field instead of number
Ultimately I am wanting to create a custom field called PO Received Month which pulls the month of the PO Received Date field, but in text format, not number format.
Currently this is the formula I put in the Formula Text field but its spitting out "4" for April and "5" for May and I want it to read "April" and "May".
TEXT(( YEAR( PO_Received_Date__c )))
Thanks in advance!
Here you go
CASE(MONTH(LPO_Received_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")
All Answers
Here you go
CASE(MONTH(LPO_Received_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")
Thank you sir. We still owe you, my boss has just been quite busy and pushing things back and back. I have not forgotten and will update you when I know more.
On a side note I have to admit that I acquired some Pliny the Edler via trade with a guy in Lafayette California and I must say you are right in your quest for it. Mighty fine stuff. Got a bottle of Blind Pig, Sculpin, and even a Stone RIS (we can get it here too but he threw it in) as well.
This formula works great but when I group a report by the formula field I created and display it on a chart it has the months in alphabetical order instead of chronological order. Any thoughts?
Then you'd just use:
Here you go...
PS. You owe me a friggin' beer!
What is strange is it orders the months but puts October first. How can I post a pic of the chart?
CASE(MONTH( CloseDate ),
1, "1. January",
2, "2. February",
3, "3. March",
4, "4. April",
5, "5. May",
6, "6. June",
7, "7. July",
8, "8. August",
9, "9. September",
10, "10. October",
11, "11. November",
12, "12. December",
"None")
have a look on below post
http://salesforce.stackexchange.com/questions/8246/getting-format-for-date
Once you have Date in new format ,you can easily get the month name also . Please let me know if you need more info .
Thanks!
Anyhow, I had left off the "None" - not sure why that made the diff, but all working now. Thanks, Steve et al!
6=>'June', 7=>'July', 8=>'August', 9=>'September',10=>'October',
11=>'November', 12=>'December'};
System.debug(monthNameMap.get(Date_Field__c.month()));
Is it also possible to get the day and year to display but as number?
Here's what I need: May 29, 2018 from 29/05/2018
Here's the documentation for formula fields: https://help.salesforce.com/articleView?id=customize_functions.htm&type=5
@Lisa Lee-Banks this will achieve what you want:
Explanation:
CASE is by far the most complicated part. CASE checks the value of the first argument (in this case MONTH( Birthdate) ), and then looks in the rest of its arguments, and find which one matches that: so, for instance, for a record where Birthdate = 29/05/2018, it would find which argument comes after 5 and that argument is "May", so it returns the text "May". The last argument is for what you get if the first argument doesn't match any of the other arguments.
NOTE: It is important to arrange your formula in a readable way. See how everyone has arranged it so that all the arguments are in pairs except the first and the last? If you don't do that it is very easy to lose track of your arguments.
MONTH( date ) checks the value of date and gives a number for the month (e.g. MONTH( Birthdate ) would return 5 if Birthdate = 29/05/2018)
& is the "concatenate" operator, meaning it combines texts together -- for instance, "May" & " " & "29" will return "May 29"
" " is there to say that we want a space -- the double quotes ("") mean that what is inside them is text -- it will just return that exact text.
TEXT( number ) will convert number to a text, (e.g., TEXT(29) would return "29"). We need to do this so that we can use the & operator on it (because & can only be used on text, not numbers)
DAY( date ) will take the day number from date (e.g. DAY( Birthdate ) would return 29 if Birthdate = 29/05/2018)
YEAR( date ) you can probably guess what it does. It gives the four digit year number.
When functions are put together like this, it's usually best to think of them from the inside out. For instance:
TEXT(DAY( Birthdate)) is saying:
Like I started with, I really recommend you read the documentation of the various functions you can use! Formula fields are pretty powerful, and there are a lot of things you can do with it.
String CurrentMonth = TodaysDate.format('MMMM');
CASE(MONTH(DATEVALUE(CreatedD)),
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")
I am trying to creat a customer birthday report by branch, and your case funtion worked great. I was just wanted to retunr the birthday vs a 1 or 0 so the user does have to drill down or search for the accoutn to find the acctual day.
Thoughts?
Your answer worked for creating month field, Now i have similar new requirement asking to use same field for 2 date fields
Can you help me on this formula.
Thanks,
ok, this only partly solves my formula. The syntax gets screwy when I put case as the second function. I want my dates to read, for example,
2 October 2022
It is a requirement on some reporting that we put dates in this format. the solution that Nathan gives above works great for showing the date as October 2, 2022. But how can I edit the formula without getting all sorts of errors... This is what I have, and it tells me incorrect syntax...
TEXT(DAY(Contact__r.Birthdate)) & " " & CASE(MONTH( Contact__r.Birthdate ),
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(Contact__r.Birthdate))
I have added the transformation in the recipe and numbered 1-April to start from the fiscal month. But while applying the global filter on the month field; the months are not ordered in ascending order. display as 1-April then 10-January, 11-February, 12, 2,3,4.. so on
Please help how can we sort the global filter.
Thank you in advance.