Activity › Forums › Salesforce® Discussions › How do I change the date format?
Tagged: Date Field, Date Format, Salesforce Apex, Salesforce SOQL
-
How do I change the date format?
Posted by Utsav on April 27, 2016 at 8:08 AMDate formatting
I have a date in format:
24-Apr-2016
I want it in the format:
24-APR-2016
Any suggestions?
Suyash replied 10 years, 1 month ago 3 Members · 3 Replies -
3 Replies
-
Hi Utsav,
You can use toUpperCase() method of string class.First you have to convert your date into string .
Date testingDate = '24-Apr-2016';
System.debug('testingDate >>>>>'+testingDate.toString().toUpperCase() +'<<<<<<<testingDate ');14:00:03:003 USER_DEBUG [2]|DEBUG|testingDate >>>>>24-APR-2016<<<<<<<testingDate
-
This reply was modified 10 years, 1 month ago by
Ravi.
-
This reply was modified 10 years, 1 month ago by
- [adinserter block='9']
-
Hi Ravi
Thanks for your response
I want to format the datetime field directly on VF page.
Currently i am using the following code for formatting of date on vf page
Code:
<apex:outputText value=”{0, date, dd’-‘MMM’-‘YYYY}”>
<apex:param value=”{!oppoObject.Sailing_Date__c}” />
</apex:outputText>Output:
24-Apr-2016
Expected Output:
24-APR-2016
Please let me know what can i do in this scenario
-
Hi Utsav,
i think you can do this by using CSS for your output text.
outputtext {
text-transform: uppercase
}Hope this helps
Thanks.
Log In to reply.