标签:led pen new put form lan simple csdn Matter
在beanshell中写入如下代码,
import java.io.FileInputStream;
SimpleDateFormat myFormatter = new SimpleDateFormat( "yyyy-MM-dd");
java.util.Date date= myFormatter.parse( "2003-06-01");
java.util.Date mydate= myFormatter.parse( "2003-05-01");
long day=(date.getTime()-mydate.getTime())/(24*60*60*1000);
System.out.println( "相差的日期: " + day);
24*60*60*1000因为(date.getTime()-mydate.getTime())得到的是相差的毫秒数,
所以除以1000得到秒,除以60得到分,除以60得到小时,除以24得到天
亲测可用
参考资料:https://blog.csdn.net/pengyu1801/article/details/50408444
java或Jmeter实现两个日期相加减(2003-06-01-2003-05-01)
标签:led pen new put form lan simple csdn Matter
原文地址:https://www.cnblogs.com/zhou-yuhang/p/9897410.html