您的位置:首页 > 其它

获取系统年月日

2016-07-05 14:51 155 查看
//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//Date d = sdf.parse("2011-10-20");
Calendar c = Calendar.getInstance();
//c.setTime(d);
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH) + 1;
int day = c.get(Calendar.DAY_OF_MONTH);
System.out.printf("year=%04d, month=%02d, day=%02d\n", year, month, day);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: