首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

获取指定日期的前一天23:59:59

/**  * 获得指定日期的前一天的23:59:59  *  * @param specifiedDay 指定日期  * @return 前一天日期 23:59:59  */ public static Date getSpecifiedDayBefore(Date specifiedDay) {     if (null == specifiedDay) {         return null;     }     Date newDate = null;     try {         Calendar c = Calendar.getInstance();         c.setTime(specifiedDay);         int day = c.get(Calendar.DATE);         c.set(Calendar.DATE, day - 1);         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");         String newDateStr = simpleDateFormat.format(c.getTime()) + " 23:59:59";         SimpleDateFormat newSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");         newDate = newSimpleDateFormat.parse(newDateStr);     } catch (ParseException e) {         log.info("日期转换错误" + e.getMessage());     }     return newDate; }

01
您找到你想要的搜索结果了吗?
是的
没有找到
领券