日期:2014-05-16  浏览次数:20462 次

oracle数据库中的date型在程序中如何进行比较
最近在看到一处代码,觉得做得挺好,这里记记
TimeInterval statTimeInterval = indexSeriesCommonProperty.getStatTimeInterval();
。。。
statTimeInterval.isIntersected(timeIntervalOutage)作为一个判断值
这里将开始时间和结束时间作为了TimeInterval 的属性,即封装成一个对象进行管理。
接着对象里面
private long startTime;
private long endTime;
是将oracle中的date型在程序中用long型进行表示,方便时间区间的判断
这里是将数据库中startTime和endTime对应的时间,从1700开始累加秒得到,这样可以就达到用long来比较了