Calendar now=Calendar.getInstance(); //获取当前系统日历对象now.get(Calendar.SECOND) //获得当前时间的秒
now.get(Calendar.MINUTE); //获得当前时间的分
now.get(Calendar.YEAR); //获得当前时间的年份
now.get(Calendar.DAY_OF_MONTH); //获得当前时间的日
now.get(Calendar.MONTH); //获取月份
now.get(Calendar.HOUR_OF_DAY); //获得当前时间的小时(24小时制)
now.get(Calendar.HOUR); //获得当前时间的小时(12小时制)
Calendar.DAY_OF_YEAR //获得今天是今年的第几天
Calendar基本用法
最新推荐文章于 2022-01-24 15:16:58 发布