判断当前时间是不是在设定时间范围

如题所述

以JAVA为例:

/**
 * 判断给定时间在否在给定两个时间之间
 */
public static void do7(String star,String end){
    SimpleDateFormat localTime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    try{
        Date sdate = localTime.parse(star);
        Date edate=localTime.parse(end);
        long time = System.currentTimeMillis();
        System.out.println(time+"##"+sdate.getTime()+"##"+edate.getTime());
        if(time>=sdate.getTime()&& time<=edate.getTime()){
            System.out.println("true");
        }
    }catch(Exception e){}
}

温馨提示:答案为网友推荐,仅供参考
第1个回答  2020-10-17
数组公式,公式输完后,光标放在公式编辑栏同时按下ctrl+shift+回车键,使数组公式生效
sheet2中c2=index(sheet1!c:c,small(if(sheet1!$a$2:$a$11=a2,row(sheet1!$a$2:$a$11),100),countif(a$2:a2,a2)))
公式向下复制
第2个回答  2017-02-16
设定什么时间?
相似回答