function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BussBuss 

Date format as "DD MMM,YYYY"

Hi All,

 

i want to know is there any way to get date format as 'DD MMM,YYYY'.i.e 20 Mar,2011.

if possibe, Pls can you explain how do i get that date format.

in my requirement having both Standard and Custom Pages on both Pages i need dispaly in "DD MMM,YYYY" Format dates.

 

Reds,

Buss

Best Answer chosen by Admin (Salesforce Developers) 
Santosh KumbarSantosh Kumbar

Hey,

 

The below formula will make date field to format u mentioned in post:

 

Lets say 'Due date' is field on you object (1/4/2012) and u want it like '4 jan, 2012' then make formula field with below formula.

 

********************************************************************

text(DAY( Due_date__c )) +' '+ CASE( MONTH( Due_date__c ) ,
1, "Jan",
2, "Feb",
3, "Mar",
4, "Apr",
5, "May",
6, "Jun",
7, "Jul",
8, "Aug",
9, "Sep",
10, "Oct",
11, "Nov",
12, "Dec",
"None") +', '+ Text(YEAR( Due_date__c ))

 

***************************************************************

 

 

Regards

San

 

All Answers

Navatar_DbSupNavatar_DbSup

Hi,

 

You can use the below code snippets for reference

 

datetime dt= system.now();

system.debug(' ??? ??? ' + dt.format('dd MMM,yyyy'));

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

Santosh KumbarSantosh Kumbar

Hey,

 

The below formula will make date field to format u mentioned in post:

 

Lets say 'Due date' is field on you object (1/4/2012) and u want it like '4 jan, 2012' then make formula field with below formula.

 

********************************************************************

text(DAY( Due_date__c )) +' '+ CASE( MONTH( Due_date__c ) ,
1, "Jan",
2, "Feb",
3, "Mar",
4, "Apr",
5, "May",
6, "Jun",
7, "Jul",
8, "Aug",
9, "Sep",
10, "Oct",
11, "Nov",
12, "Dec",
"None") +', '+ Text(YEAR( Due_date__c ))

 

***************************************************************

 

 

Regards

San

 

This was selected as the best answer
BussBuss

Thanks Guys,

 

While debugging it is Showing on Console, but doing this Operation on My Object Date variable showing error as "Method does not valid as format() with String Argument".

 

So according to my uderstanding these Helpful to display on VFPage, but not to do Operation on Object Date Variables.

 

Reds,

Buss

 

 

Navatar_DbSupNavatar_DbSup

Hi,


Change the Formula Return Type from date to text.

ErikNelke1ErikNelke1
Question - How would you amend the formula to insert a leading 0 for the day when the day is less than 10?

I have two date fields stacked one above the other and when the dates are displayed 01 Nov 2015 is shown as

1 Nov  2015   below that is
30 Nov 2015

It looks a bit off that way and wondered if it could be adjusted.

Thank you.
John Moura 9John Moura 9

This solves the issue with the date padding mentioned by Erik.

LPAD(TEXT(DAY( Due_date__c)), 2,'0') +' '+ CASE( MONTH(Due_date__c) ,
1, "Jan",
2, "Feb",
3, "Mar",
4, "Apr",
5, "May",
6, "Jun",
7, "Jul",
8, "Aug",
9, "Sep",
10, "Oct",
11, "Nov",
12, "Dec",
"None") +', '+TEXT(YEAR(Due_date__c))