Skip to content

Instantly share code, notes, and snippets.

@NIA
Created January 29, 2011 13:05
Show Gist options
  • Select an option

  • Save NIA/801810 to your computer and use it in GitHub Desktop.

Select an option

Save NIA/801810 to your computer and use it in GitHub Desktop.
parsing JSON data to Calendar
private static final String dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"; // 2011-01-29T00:02:08+06:00
public static Calendar parseDate(String strDate) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat, Locale.US);
Calendar cal = Calendar.getInstance();
cal.setTime(sdf.parse(strDate));
return cal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment