+ Start a Discussion
Baktash H.Baktash H. 

Simple Datetime conversion

Hello,

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:

DD.MM.YYYY

 

Thank you in advance.

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

Hello,

     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.