1、文章:https://blog.csdn.net/fire_mole/article/details/87865168
https://www.jianshu.com/p/d0ea66d38bed
2、使用
//获取系统的 日期
Calendar calendar=Calendar.getInstance();
//年
int year = calendar.get(Calendar.YEAR);
//月
int month = calendar.get(Calendar.MONTH)+1; //日 int day = calendar.get(Calendar.DAY_OF_MONTH); //小时 int hour = calendar.get(Calendar.HOUR_OF_DAY); //分钟 int minute = calendar.get(Calendar.MINUTE); //秒 int second = calendar.get(Calendar.SECOND);
来源:oschina
链接:https://my.oschina.net/u/4350756/blog/3407283