コード例 #1
0
ファイル: TimeId.java プロジェクト: iDuduba/fcd
  public TimeId(String date, String time) {
    this.date = date;
    this.time = time;

    dateTime = DateTime.parse(date + time, formatter);
    timeId = dateTime.getSecondOfDay() / 300 + 1;
  }
コード例 #2
0
 /**
  * Extends the CSV row
  *
  * @param row existing row
  * @return the extended row
  */
 public String[] extendRow(String[] row) {
   List<String> rowExt = new ArrayList<String>();
   for (int i = 0; i < dateColumnIndexes.size(); i++) {
     SourceColumn c = dates.get(i);
     int idx = dateColumnIndexes.get(i);
     int adjustedDataIndex =
         ((identityColumn >= 0) && (idx >= identityColumn)) ? (idx - 1) : (idx);
     String dateValue = row[idx];
     if (dateValue != null && dateValue.trim().length() > 0) {
       try {
         DateTimeFormatter formatter = dateColumnFormats.get(i);
         DateTime dt = formatter.parseDateTime(dateValue);
         Days ds = Days.daysBetween(base, dt);
         rowExt.add(Integer.toString(ds.getDays() + 1));
         if (c.isDatetime()) {
           int ts = dt.getSecondOfDay();
           rowExt.add(Integer.toString(ts));
           String scs = Integer.toString(ts);
           rowExt.add((scs.length() > 1) ? (scs) : ("0" + scs));
         }
       } catch (IllegalArgumentException e) {
         l.debug("Can't parse date " + dateValue);
         rowExt.add("");
         if (c.isDatetime()) {
           rowExt.add("");
           rowExt.add("00");
         }
       }
     } else {
       rowExt.add("");
       if (c.isDatetime()) {
         rowExt.add("");
         rowExt.add("00");
       }
     }
   }
   if (rowExt.size() > 0) return mergeArrays(row, rowExt.toArray(new String[] {}));
   else return row;
 }
コード例 #3
0
 public static int timeSecsNoTZ(long millis) {
   DateTime dt = new DateTime(millis);
   return dt.getSecondOfDay();
 }