显示当前日期时间
1 private String getCurrentDate() { 2 final Calendar c = Calendar.getInstance(); 3 c.setTimeZone(TimeZone.getTimeZone("GMT+8:00")); 4 String mYear = String.valueOf(c.get(Calendar.YEAR)); // 获取当前年份 5 String mMonth = String.valueOf(c.get(Calendar.MONTH) + 1);// 获取当前月份 6 String mDay = String.valueOf(c.get(Calendar.DAY_OF_MONTH));// 获取当前月份的日期号码 7 String mWay = String.valueOf(c.get(Calendar.DAY_OF_WEEK)); 8 9 if ("1".equals(mWay)) { 10 mWay = "天"; 11 } else if ("2".equals(mWay)) { 12 mWay = "一"; 13 } else if ("3".equals(mWay)) { 14 mWay = "二"; 15 } else if ("4".equals(mWay)) { 16 mWay = "三"; 17 } else if ("5".equals(mWay)) { 18 mWay = "四"; 19 } else if ("6".equals(mWay)) { 20 mWay = "五"; 21 } else if ("7".equals(mWay)) { 22 mWay = "六"; 23 } 24 return mYear + "年" + mMonth + "月" + mDay + "日" + " 星期" + mWay; 25 }