New answers tagged

0 votes

Unable to convert a particular string format to DateTime

You can use JSON to correctly parse the values back into DateTime values. DateTime dt1 = (DateTime)JSON.deserialize('"'+d1+'"', DateTime.class); DateTime dt2 = (DateTime)JSON.deserialize('&...
sfdcfox's user avatar
  • 481k
0 votes

Unable to convert a particular string format to DateTime

Try using: ().. DateTime dt1 = Datetime.valueOf(d1.replace('T',' ')); DateTime dt1 = Datetime.valueOf(d2.replace('T',' '));
Carlos's user avatar
  • 115

Top 50 recent answers are included