Activity › Forums › Salesforce® Discussions › How we can Convert String containing date time to a DateTime in APEX Salesforce® Discussions How we can Convert String containing date time to a DateTime in APEX Posted by Marziya on May 8, 2020 at 1:23 PM How we can Convert String containing date time to a DateTime in APEX Ayush replied 6 years ago 3 Members · 2 Replies 2 Replies Kirandeep Member May 8, 2020 at 1:50 PM Hi Marziya , With the use of valueOf(dateTimeString) function of Datetime class we can convert thevalue of the specified string specified string into DateTime. [adinserter block='9'] Ayush Member May 11, 2020 at 5:58 AM Help of this function valueOf(dateTimeString) Log In to reply. Public All Members My Connections Only Me PublicAll MembersMy ConnectionsOnly Me Public All Members My Connections Only Me