Skip to content

Instantly share code, notes, and snippets.

@ruan65
Created June 29, 2016 07:59
Show Gist options
  • Save ruan65/e2714e63e25a129eb7c1730623461f94 to your computer and use it in GitHub Desktop.
Save ruan65/e2714e63e25a129eb7c1730623461f94 to your computer and use it in GitHub Desktop.
getDateStringFromMaximoTimeFormat
public static String getDateStringFromMaximoTimeFormat(String datestring) {
final String ISO8601DATEFORMAT = "yyyy-MM-dd'T'HH:mm:ss";
Calendar calendar = Calendar.getInstance() ;
SimpleDateFormat dateformat = new SimpleDateFormat(ISO8601DATEFORMAT, Locale.getDefault());
try {
Date date = dateformat.parse(datestring.substring(0, 19));
date.setHours(date.getHours()-1);
calendar.setTime(date);
} catch (ParseException e) {
e.printStackTrace();
}
SimpleDateFormat df = new SimpleDateFormat("dd MM yyyy");
return df.format(calendar.getTime());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment