Calendar calendar = Calendar.getInstance();//获取当前日期 calendar.add(Calendar.MONTH, 0);//n代表和本月偏移 0本月、1后一月,-1前一月 calendar.set(Calendar.DAY_OF_MONTH, 1);//设置为1号,当前日期既为本月第一天 calendar.set(Calendar.HOUR_OF_DAY,0);//将小时至0 calendar.set(Calendar.MINUTE,0);//将分钟至0 calendar.set(Calendar.SECOND,0);//将秒至0 long start = calendar.getTime().getTime(); calendar.add(Calendar.MONTH, 1); calendar.set(Calendar.SECOND,-1); long end = calendar.getTime().getTime();
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)