Last active
September 6, 2016 08:29
-
-
Save oludouglas/71f266530951ba2f1c0a6eff1b881e41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String getTime(String dateString){ | |
Calendar calendar = GregorianCalendar.getInstance(); | |
try { | |
String newString = null; | |
if(dateString.contains("+")) | |
newString = dateString.substring(0, dateString.indexOf("+")); | |
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:sss"); | |
Date date = format.parse(newString); | |
calendar.setTime(date); | |
} catch (ParseException e) { | |
e.printStackTrace(); | |
} | |
return String.valueOf(calendar.getTime()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i will keep that for future use