发现博主http://www.oschina.net/code/snippet_575610_22694时间处理工具类比较好,收藏~
/**
* 课程列表开始和结束时间
* 接口返回标准格式时需要处理为 HH:mm
* @param time
* @return
*/
public static String timeHourMinute(String time) {
return time.substring(11, 16);
}
/**
* 根据一个日期,返回是星期几的字符串
* 接口返回标准格式时需要处理为 yyyy/MM/dd
* @param sdate
* @return
*/
public static String getyear(String sdate) {
// 再转换为时间
Date date = strToDate(sdate);
Calendar c = Calendar.getInstance();
c.setTime(date);
return new SimpleDateFormat("yyyy/MM/dd").format(c.getTime());
}