+ 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 ;