Java day of the week from string
问题 I have this simple code: SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Date date = format.parse("2011-10-29"); calendar.setTime(date); Log.d("Debug","Day of the week = "+(calendar.get(Calendar.DAY_OF_WEEK)==Calendar.SATURDAY)); The 29th of October is a Saturday so why do I get false? 回答1: Here is an example of how this could happen... SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Date date = null; try { date = format.parse("2011-10-29"); } catch (ParseException