android初学------根据日期时间字符串返回date数据 获取年月日

来源:互联网 发布:机器人编程入门教程 编辑:程序博客网 时间:2024/05/21 04:00
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");   Date date2;date2 = format.parse("2014-10-12");Calendar calendar=Calendar.getInstance();calendar.setTime(date2);


可以通过Calendar.setTime把日期设置进去 然后通过calendar.get(Calendar.YEAR)  。。。。。。获取年月日

0 0