public static long getSourceMillis(String time) { try { SimpleDateFormat formatYear = new SimpleDateFormat("yyyy年MM月dd日"); Calendar sourceDay = Calendar.getInstance(); sourceDay.setTime(formatYear.parse(time)); sourceDay.set(Calendar.MILLISECOND, 0); sourceDay.set(Calendar.SECOND, 0); sourceDay.set(Calendar.MINUTE, 0); sourceDay.set(Calendar.HOUR_OF_DAY, 0); return sourceDay.getTimeInMillis(); } catch (ParseException e) { e.printStackTrace(); return 0; } }