以下是在SimpleDateFormat中解析日期的示例
String string = "2014-04-21 17:35:00";
Calendar calender = Calendar.getInstance();
DateFormat format = new SimpleDateFormat( "yyyy-MM-dd kk:mm:ss");
Date date;
date = format.parse( string );
calender.setTime(date);
System.out.println("Day of week: " + calender.get(Calendar.DAY_OF_WEEK)); //2 is monday
System.out.println("Day of the month: " + calender.get(Calendar.DAY_OF_MONTH));
System.out.println("Month: " + calender.get(Calendar.MONTH)); //0 is january 3 is april
System.out.println("Year: " + calender.get(Calendar.YEAR));
System.out.println("Hour: " + calender.get(Calendar.HOUR_OF_DAY));
System.out.println("Minutes: " + calender.get(Calendar.MINUTE));