// date为当前时间 date1为过期时间 public static String judgeDeadLine(Date date, Date date1) throws IllegalAccessException { if (date == null || date1 == null) throw new IllegalAccessException("日期不可为空"); long time1 = date.getTime(), time2 = date1.getTime(); if (time1 - time2 > 0) { System.out.println("已经过期"); return null; } long second = (time2 - time1) / 1000; StringBuilder sb = new StringBuilder("还剩"); int day = (int) (second / 86400); sb.append(day).append("天"); second %= 86400; int hour = (int) (second / 3600); sb.append(hour).append("小时"); second %= 3600; int min = (int) (second / 60); sb.append(min).append("分").append(second %= 60).append("秒过期"); return sb.toString(); }
点赞 评论

相关推荐

小浪_Coding:1. 个人技能排版太乱, 写的技术栈太浅了, 跟测试,自动化相关的太少; 2. 项目开发类的太简单没有亮点, 算法类的项目建议只放一个,最好有自动化,CI/CD, pipline的项目, 需要更换; 3.整体排版需要优化, SOOB打招呼都需要注意等.
我的简历长这样
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务