我在中收到iso格式日期Java。我如何解析它得到MM和DD。
iso
Java
MM
DD
ISO格式的日期:2015-08-10T21:00:00.090Z
2015-08-10T21:00:00.090Z
一些参考
http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html http://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html
Calendar cal = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()) ; SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.getDefault()); try { Date date = dateformat.parse("2015-08-10T21:00:00.090Z"); cal.setTime(date); String result = new SimpleDateFormat("MM dd", Locale.getDefault()).format(cal.getTime()); System.out.println(result); } catch (ParseException e) { e.printStackTrace(); }
希望能帮助到你