+ Start a Discussion
Baktash H.Baktash H. 

Simple Datetime conversion


I want to change to Change the format of a CreatedDate.

Now when i put it on a VF it looks like this:

Sat Oct 08 11:07:45 GMT 2011


I used valueofGmt, format, and that stuff but nothing worked for me to convert it to this format:



Thank you in advance.

Best Answer chosen by Admin (Salesforce Developers) 
ashish raiashish rai


     Use this.

Datetime GMTDate = Datetime.newInstanceGmt(2011,6,1,12,1,5);

String strConvertedDate = GMTDate.format('dd.MM.yyyy ', 'PST');

system.debug('@@@@@@' +strConvertedDate );



Think this will help you.