Parse Datetime String to DateTime in Apex / Salesforce / By Ayub Datetime dtime = (Datetime)JSON.deserialize('"2024-12-20T00:00:00Z"', Datetime.class);