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
cherry@forcecherry@force 

how to change the date format

how to change date format mm/dd/yy to dd/mm/yy format in salesforce...

Pradeep_NavatarPradeep_Navatar

Below is the sample code to change the date format in Salesforce apex code-

 

            String[] strTemp = new String[]{};

            String = ddmmyyDateF;

            strTemp = mmddyyDate.split('/'); // mmddyyDate is the date which is in mm/dd/yy format.

            if(strTemp.size() == 3)

            {

                        mm = integer.valueOf(strTemp[1]);

                        dd = integer.valueOf(strTemp[0]);

                        yy = integer.valueOf(strTemp[2]);

 

                        ddmmyyDateF = strTemp[2] + '-' + strTemp[0] + '-' + strTemp[1];  

            }

            Date ddmmyyDate = Date.valueOf(ddmmyyDateF); // if date needed.

            DateTime ddmmyyDateTime = datetime.newInstance(yy, mm, dd); // if date time needed.

charan@appcharan@app

thanks for your reply...

 

But, I need it through custoomisation?

 

Are there any settings that can be changed in Salesforce.com so that we can change the date format

 

We have such option here in Board by going to Profile settings...