本文共 315 字,大约阅读时间需要 1 分钟。
一、Long型转成Calendar
优化后的代码示例:Calendar endCalendar = Calendar.getInstance();endCalendar.setTimeInMillis(endTime);二、通过Calendar获取年月日信息
年:endCalendar.get(Calendar.YEAR)月:endCalendar.get(Calendar.MONTH)日:endCalendar.get(Calendar.DAY_OF_MONTH)同样,Date类型转成Calendar只需多一步,将Date先转为Long即可:
Long time = new Date().getTime();转载地址:http://kkolz.baihongyu.com/