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
Anupama@28Anupama@28 

User local date format

Hi,

 

Is there any built in method in apex to convert a random date to user local date format?

or

is there any built in method in apex to get the date format of the user local.

for Ex : UserInfo.getLocale(); gives the user local, same way any built method to get the date format like dd/mm/yy etc..

Best Answer chosen by Admin (Salesforce Developers) 
Anupama@28Anupama@28

I got the solution....

 

    Ex: String dateString = '2013-09-23T07:54:15.000Z';
          DateTime myDate = date.valueOf(dateString);

          String formattedDate = myDate.format();
          return formattedDate ;