标签:int create time oid 类型 orm java string exception
public static void main(String[] args) throws ParseException {
String firstDate = "2019-01-01";
String lastDate = "2019-012-31";
String createdTime = "2019-07-20";
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd"); //创建日期转换对象:年 月 日
Long time = sdf.parse(createdTime).getTime();
Long time1 = sdf.parse(firstDate).getTime();
Long time2 = sdf.parse(lastDate).getTime();
if(time>=time1 && time<=time2){//转成long类型比较
System.out.println("在该时间段范围内");
}else{
System.out.println("不在该时间段范围内");
}
}
标签:int create time oid 类型 orm java string exception
原文地址:https://www.cnblogs.com/wueryuan/p/12120560.html