Skip to content

Instantly share code, notes, and snippets.

@kiran-machhewar
Created June 29, 2018 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiran-machhewar/b70691da07e694d14bd441f5d8bff694 to your computer and use it in GitHub Desktop.
Save kiran-machhewar/b70691da07e694d14bd441f5d8bff694 to your computer and use it in GitHub Desktop.
Get the DateTime from the Dates format which is GMT
/**
* @dateString : format should be like this 2018-06-10T12:34:15.29
*/
public DateTime parseDate(String dateString){
String dateStringJSON = ('{ "thedate": "'+dateString+'"}');
Map<String, DateTime> mockMap;
mockMap = (Map<String, DateTime>)JSON.deserialize(dateStringJSON, Map<String, DateTime>.class);
return mockMap.get('thedate');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment