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

how to change the date format

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


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.


thanks for your reply...


But, I need it through custoomisation?


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


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