Last active
September 12, 2016 14:23
-
-
Save stsatlantis/4c4f4811f6f46d223d2d9925eea0e5fc 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
private DateTime getDateTime(String time) { | |
DateTime result = null; | |
final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss"; | |
if (time != null) { | |
try { | |
DateTimeFormatter DATETIME_FORMATTER = DateTimeFormat.forPattern(DATE_FORMAT); | |
DateTimeZone dateTimeZone = DateTimeZone.forID("GMT+0"); | |
DateTime date = DATETIME_FORMATTER.withZone(dateTimeZone).parseDateTime(time); | |
result = date.toDateTime(DateTimeZone.getDefault()); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
return result; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment