org.apache.kylin.common.util.DateFormat.formatToTimeStr()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(181)

本文整理了Java中org.apache.kylin.common.util.DateFormat.formatToTimeStr()方法的一些代码示例,展示了DateFormat.formatToTimeStr()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateFormat.formatToTimeStr()方法的具体详情如下:
包路径:org.apache.kylin.common.util.DateFormat
类名称:DateFormat
方法名:formatToTimeStr

DateFormat.formatToTimeStr介绍

暂无

代码示例

代码示例来源:origin: apache/kylin

@Override
  public String toString() {
    return "BadQueryEntry [ adj=" + adj + ", server=" + server + ", startTime=" + DateFormat.formatToTimeStr(startTime) + " ]";
  }
}

代码示例来源:origin: apache/kylin

public static String formatToTimeStr(long millis) {
  return formatToTimeStr(millis, DEFAULT_DATETIME_PATTERN_WITH_MILLISECONDS);
}

代码示例来源:origin: apache/kylin

public static String formatToTimeWithoutMilliStr(long millis) {
  return formatToTimeStr(millis, DEFAULT_DATETIME_PATTERN_WITHOUT_MILLISECONDS);
}

代码示例来源:origin: apache/kylin

public static String formatTsRange(Range<Long> tsRange) {
  if (tsRange == null)
    return null;
  StringBuilder sb = new StringBuilder();
  if (tsRange.hasLowerBound()) {
    if (tsRange.lowerBoundType() == BoundType.CLOSED) {
      sb.append("[");
    } else {
      sb.append("(");
    }
    sb.append(DateFormat.formatToTimeStr(tsRange.lowerEndpoint()));
  } else {
    sb.append("(-∞");
  }
  sb.append("~");
  if (tsRange.hasUpperBound()) {
    sb.append(DateFormat.formatToTimeStr(tsRange.upperEndpoint()));
    if (tsRange.upperBoundType() == BoundType.CLOSED) {
      sb.append("]");
    } else {
      sb.append(")");
    }
  } else {
    sb.append("+∞)");
  }
  return sb.toString();
}

代码示例来源:origin: apache/kylin

private String formatTime(String dateStr, DataType dataType) {
    if (dataType.isDatetime() || dataType.isTime()) {
      throw new RuntimeException("Datetime and time type are not supported yet");
    }

    if (DateFormat.isSupportedDateFormat(dateStr)) {
      return dateStr;
    }

    long millis = Long.parseLong(dateStr);
    if (dataType.isTimestamp()) {
      return DateFormat.formatToTimeStr(millis);
    } else if (dataType.isDate()) {
      return DateFormat.formatToDateStr(millis);
    } else {
      throw new RuntimeException("Unknown type " + dataType + " to formatTime");
    }
  }
}

代码示例来源:origin: apache/kylin

public void test1() throws Exception {
  System.out.println(org.apache.kylin.common.util.DateFormat.formatToTimeStr(1433833611000L));
  System.out.println(org.apache.kylin.common.util.DateFormat.formatToTimeStr(1433250517000L));
  System.out.println(org.apache.kylin.common.util.DateFormat.stringToMillis("2015-06-01 00:00:00"));
  System.out.println(org.apache.kylin.common.util.DateFormat.stringToMillis("2015-05-15 17:00:00"));

代码示例来源:origin: apache/kylin

@Override
public String next() {
  if (type.isStringFamily()) {
    // string
    return format.replace(ColumnGenConfig.$RANDOM, "" + randomInt());
  } else if (type.isTimeFamily()) {
    // time
    return DateFormat.formatToTimeStr(randomMillis(), format);
  } else if (type.isDateTimeFamily()) {
    // date
    return DateFormat.formatToDateStr(randomMillis(), format);
  } else if (type.isIntegerFamily()) {
    // integer
    return formatNumber(randomInt());
  } else if (type.isNumberFamily()) {
    // double
    return formatNumber(randomDouble());
  } else {
    throw new IllegalStateException();
  }
}

代码示例来源:origin: org.apache.kylin/kylin-core-metadata

@Override
  public String toString() {
    return "BadQueryEntry [ adj=" + adj + ", server=" + server + ", startTime=" + DateFormat.formatToTimeStr(startTime) + " ]";
  }
}

代码示例来源:origin: org.apache.kylin/kylin-core-common

public static String formatToTimeStr(long millis) {
  return formatToTimeStr(millis, DEFAULT_DATETIME_PATTERN_WITH_MILLISECONDS);
}

代码示例来源:origin: org.apache.kylin/kylin-core-common

public static String formatToTimeWithoutMilliStr(long millis) {
  return formatToTimeStr(millis, DEFAULT_DATETIME_PATTERN_WITHOUT_MILLISECONDS);
}

代码示例来源:origin: org.apache.kylin/kylin-core-common

public static String formatTsRange(Range<Long> tsRange) {
  if (tsRange == null)
    return null;
  StringBuilder sb = new StringBuilder();
  if (tsRange.hasLowerBound()) {
    if (tsRange.lowerBoundType() == BoundType.CLOSED) {
      sb.append("[");
    } else {
      sb.append("(");
    }
    sb.append(DateFormat.formatToTimeStr(tsRange.lowerEndpoint()));
  } else {
    sb.append("(-∞");
  }
  sb.append("~");
  if (tsRange.hasUpperBound()) {
    sb.append(DateFormat.formatToTimeStr(tsRange.upperEndpoint()));
    if (tsRange.upperBoundType() == BoundType.CLOSED) {
      sb.append("]");
    } else {
      sb.append(")");
    }
  } else {
    sb.append("+∞)");
  }
  return sb.toString();
}

代码示例来源:origin: org.apache.kylin/kylin-core-metadata

private String formatTime(String dateStr, DataType dataType) {
    if (dataType.isDatetime() || dataType.isTime()) {
      throw new RuntimeException("Datetime and time type are not supported yet");
    }

    if (DateFormat.isSupportedDateFormat(dateStr)) {
      return dateStr;
    }

    long millis = Long.parseLong(dateStr);
    if (dataType.isTimestamp()) {
      return DateFormat.formatToTimeStr(millis);
    } else if (dataType.isDate()) {
      return DateFormat.formatToDateStr(millis);
    } else {
      throw new RuntimeException("Unknown type " + dataType + " to formatTime");
    }
  }
}

代码示例来源:origin: org.apache.kylin/kylin-core-metadata

@Override
public String next() {
  if (type.isStringFamily()) {
    // string
    return format.replace(ColumnGenConfig.$RANDOM, "" + randomInt());
  } else if (type.isTimeFamily()) {
    // time
    return DateFormat.formatToTimeStr(randomMillis(), format);
  } else if (type.isDateTimeFamily()) {
    // date
    return DateFormat.formatToDateStr(randomMillis(), format);
  } else if (type.isIntegerFamily()) {
    // integer
    return formatNumber(randomInt());
  } else if (type.isNumberFamily()) {
    // double
    return formatNumber(randomDouble());
  } else {
    throw new IllegalStateException();
  }
}

相关文章