Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); //获取昨日时间 calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 1); // calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 10); String transdt = new SimpleDateFormat("yyyyMMdd").format(calendar.getTime()); //获取当前月份 // int month = calendar.get(Calendar.MONTH) + 1; int month = calendar.get(Calendar.MONTH) + 1; String monthStr = String.valueOf(month >= 10 ? month : "0" + month);
月份和日期的获取
最新推荐文章于 2023-10-28 12:01:06 发布