Android获取当前时间与星期几
2018-07-20 来源:open-open
publicclassDataString { privatestaticString mYear; privatestaticString mMonth; privatestaticString mDay; privatestaticString mWay; publicstaticString StringData(){ finalCalendar c = Calendar.getInstance(); c.setTimeZone(TimeZone.getTimeZone("GMT+8:00")); mYear = String.valueOf(c.get(Calendar.YEAR));// 获取当前年份 mMonth = String.valueOf(c.get(Calendar.MONTH) +1);// 获取当前月份 mDay = String.valueOf(c.get(Calendar.DAY_OF_MONTH));// 获取当前月份的日期号码 mWay = String.valueOf(c.get(Calendar.DAY_OF_WEEK)); if("1".equals(mWay)){ mWay ="天"; }elseif("2".equals(mWay)){ mWay ="一"; }elseif("3".equals(mWay)){ mWay ="二"; }elseif("4".equals(mWay)){ mWay ="三"; }elseif("5".equals(mWay)){ mWay ="四"; }elseif("6".equals(mWay)){ mWay ="五"; }elseif("7".equals(mWay)){ mWay ="六"; } returnmYear +"年"+ mMonth +"月"+ mDay+"日"+"/星期"+mWay; } }
标签: ssd
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。
最新资讯
热门推荐