Esempio n. 1
0
  static {
    String path = System.getProperty("user.dir");

    //		// 初始化信息,jar包路径,记录文件名
    //		URL url = TimerDeptHandle.class.getProtectionDomain().getCodeSource().getLocation();
    //		String path = url.getPath();

    file = new File(path, filename);
    if (!file.exists()) {
      try {
        file.createNewFile();
      } catch (IOException e) {
      }
    }
    String time = FileUtils.readFile(file);
    if (StringUtils.isEmpty(time)) {
      // 无数据时,默认半年前
      lastUpdTime = DateUtils.add(new Date(), Calendar.MONTH, -6);
      FileUtils.write(file, String.valueOf(lastUpdTime.getTime()));
    } else {
      // 有数据时,作为最后更新时间
      lastUpdTime = new Date(Long.valueOf(time.trim()));
    }
  }
Esempio n. 2
0
 public Date negativeOffsetFrom(Date time) {
   return DateUtils.add(time, calendarField, -quantity);
 }
Esempio n. 3
0
 public Date offsetFrom(Date time) {
   return DateUtils.add(time, calendarField, quantity);
 }