1 2 3 4 5 6 7 8 9 |
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); Date date = sdf.parse(yourdate); Calendar cal=Calendar.getInstance(); if(null!=date) { cal.setTime(date); if (Calendar.AM == cal.get(Calendar.AM_PM)) { return "上午"; } } |