0

I have a formula text field that convert the date from 15/06/2015 to 15 June,2015. Is there a way to get the postfix portion of the date ie : 15th.

My formula is :

TEXT(DAY( Wedding_Date__c ))+ " " +CASE(MONTH(Wedding_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") 
+ ", " + TEXT(YEAR(Wedding_Date__c))
2

No, there is not. You might want to use another formula :

CASE(MATH.Mode(DAY( Wedding_Date__c ), 10),
1, "st",
2, "nd",
3, "rd",
"th"
)
3
  • Suggest you also add 21, 22 and 23 to this; they are also normally exceptions to "th". – Keith C Jun 15 '15 at 11:25
  • @Julien Gaïotto yes there is a way. Find formula below. – Tommy Georgiou Jun 15 '15 at 11:35
  • @KeithC yes thanks I completely forgot those ones :/ – Julien Gaïotto Jun 15 '15 at 12:50
0

For the reference of others. YES you can get the postfix portion. Formula is :

IF( 
ISBLANK( Wedding_Date__c ), 
NULL, 
( 
TEXT(DAY(Wedding_Date__c))& 
CASE( 
DAY(Wedding_Date__c), 
1, 'st', 
2, 'nd', 
3, 'rd', 
21,'st', 
22,'nd', 
23,'rd', 
31,'st', 
'th' 

)&' '& 
CASE( 
MONTH( Wedding_Date__c), 
1, "January", 
2, "February", 
3, "March", 
4, "April", 
5, "May", 
6, "June", 
7, "July", 
8, "August", 
9, "September", 
10, "October", 
11, "November", 
"December" 
)&','& 
TEXT(YEAR(Wedding_Date__c)) 
) 
)
2
  • Yes there is a way of course, what I meant is there is no formula to do it ;) And I suggested another formula in order not to complexify the current one, and respect Salesforce best practice. – Julien Gaïotto Jun 15 '15 at 12:49
  • @Julien Hi thank you for your input. the formula above gives the desire solution – Tommy Georgiou Jun 15 '15 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.