android 根据设置的日期获取星期几
2017-05-23 16:08
381 查看
/** * 判断当前日期是星期几 * * @param pTime 设置的需要判断的时间 //格式如2012-09-08 * * @return dayForWeek 判断结果 * @Exception 发生异常 */ // String pTime = "2012-03-12"; private String getWeek(String pTime) { String Week = ""; SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Calendar c = Calendar.getInstance(); try { c.setTime(format.parse(pTime)); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (c.get(Calendar.DAY_OF_WEEK) == 1) { Week += "天"; } if (c.get(Calendar.DAY_OF_WEEK) == 2) { Week += "一"; } if (c.get(Calendar.DAY_OF_WEEK) == 3) { Week += "二"; } if (c.get(Calendar.DAY_OF_WEEK) == 4) { Week += "三"; } if (c.get(Calendar.DAY_OF_WEEK) == 5) { Week += "四"; } if (c.get(Calendar.DAY_OF_WEEK) == 6) { Week += "五"; } if (c.get(Calendar.DAY_OF_WEEK) == 7) { Week += "六"; } return Week; }
相关文章推荐
- android 根据设置的日期获取星期几
- android 根据设置的日期获取星期几
- android 根据设置的日期获取星期几
- android 根据设置的日期获取星期几
- 根据指定的日期字符串获取星期几
- 根据日期字符串获取星期几,日期获取星期,时间获取星期,js获取星期
- php根据日期获取到时星期几
- Android根据所设置的textSize获取字体高度和设置行高
- Android根据系统设置获得对应格式的当前日期字符串
- 根据日期 获取星期几
- 根据日期显示星期几,根据日期获取当前星期几
- android初学------根据日期时间字符串返回date数据 获取年月日
- hive根据日期获取星期几的方法
- Android根据时间获取星期几
- 根据日期获取当前星期几
- Android工具方法- 获取当前日期是星期几
- js获取星期,根据日期字符串获取星期几,日期获取星期,时间获取星期
- hive根据日期获取星期几的方法
- Android根据当前时间获取前面的时间日期,或者之后的时间日期
- java写的日期工具,根据设置日期获取指定的一周或者一个月的所有日期