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
siva shakthisiva shakthi 

date/time to date in text format

Hi,

Thanks in Advance,
I want to create a date format like this November 29th, 2019 from date/Time field using Apex class.
Best Answer chosen by siva shakthi
Gian Piere VallejosGian Piere Vallejos
Hello, 

You can use:
DateTime dT = System.now();
String formattedDate = dT.formatGMT('MMMM d, yyyy');
formattedDate would returns November 29, 2019
 

All Answers

Gian Piere VallejosGian Piere Vallejos
Hello, 

You can use:
DateTime dT = System.now();
String formattedDate = dT.formatGMT('MMMM d, yyyy');
formattedDate would returns November 29, 2019
 
This was selected as the best answer
Ajay K DubediAjay K Dubedi
Hi Siva,

Click on this link it will be helpful for you.

https://salesforce.stackexchange.com/questions/148660/convert-string-to-datetime

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com