Activity Forums Salesforce® Discussions How do I change the date format?

  • Ravi

    Member
    April 27, 2016 at 8:31 am

    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 7 years, 11 months ago by  Ravi.
  • Utsav

    Member
    April 27, 2016 at 9:45 am

    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

  • Suyash

    Member
    April 27, 2016 at 11:08 am

    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.

Popular Salesforce Blogs

Popular Salesforce Videos