工作中遇到bug
public static Map<String, Object> dateToInt(Date date){ Map<String, Object> map=new HashMap<String, Object>(); Calendar c = Calendar.getInstance(); c.setTime(date); int year = c.get(Calendar.YEAR);//獲取年份\ int month=c.get(Calendar.MONTH)+1;//獲取月份 int day=c.get(Calendar.DATE);//獲取日 int hour=c.get(Calendar.HOUR);//小時 int minute=c.get(Calendar.MINUTE);//分 int second=c.get(Calendar.SECOND);//秒 map.put("year", year); map.put("month", month); map.put("day", day); map.put("hour", hour); map.put("minute", minute); map.put("second", second); String string=year+"年"+month+"月"+day+"日 "+hour+"時"+minute+"分"+second+"秒"; map.put("string", string); return map; }