Calendar cale = null;
cale = Calendar.getInstance();
int year = cale.get(Calendar.YEAR);
int month = cale.get(Calendar.MONTH) + 1;
int day = cale.get(Calendar.DATE);
int hour = cale.get(Calendar.HOUR_OF_DAY);
int minute = cale.get(Calendar.MINUTE);
int second = cale.get(Calendar.SECOND);
int dow = cale.get(Calendar.DAY_OF_WEEK);//从周日开始计算
int dom = cale.get(Calendar.DAY_OF_MONTH);//本月第几天
int doy = cale.get(Calendar.DAY_OF_YEAR);//本年第多少天
java 获取当前时间相关操作
最新推荐文章于 2023-10-12 22:56:09 发布