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

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

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

DateFormat.getDateFormat介绍

暂无

代码示例

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

public DateTimeParser(Map<String, String> properties) {
  super(properties);
  tsPattern = properties.get(StreamingParser.PROPERTY_TS_PATTERN);
  try {
    formatter = org.apache.kylin.common.util.DateFormat.getDateFormat(tsPattern);
  } catch (Throwable e) {
    throw new IllegalStateException("Invalid tsPattern: '" + tsPattern + "'.");
  }
}

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

public static Date stringToDate(String str, String pattern) {
  Date date = null;
  try {
    date = getDateFormat(pattern).parse(str);
  } catch (ParseException e) {
    throw new IllegalArgumentException("'" + str + "' is not a valid date of pattern '" + pattern + "'", e);
  }
  return date;
}

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

public static String formatToTimeStr(long millis, String pattern) {
  return getDateFormat(pattern).format(new Date(millis));
}

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

public static String formatToDateStr(long millis, String pattern) {
  return getDateFormat(pattern).format(new Date(millis));
}

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

public static String dateToString(Date date, String pattern) {
  return getDateFormat(pattern).format(date);
}

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

@Test
@Ignore("for dev only")
public void test3() throws Exception {
  FastDateFormat formatter = org.apache.kylin.common.util.DateFormat.getDateFormat("MMM dd, yyyy hh:mm:ss aa");
  System.out.println(formatter.format(new Date()));
  String timeStr = "Jul 20, 2016 9:59:17 AM";
  System.out.println(formatter.parse(timeStr).getTime());
}

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

public static String dateToString(Date date, String pattern) {
  return getDateFormat(pattern).format(date);
}

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

public static Date stringToDate(String str, String pattern) {
  Date date = null;
  try {
    date = getDateFormat(pattern).parse(str);
  } catch (ParseException e) {
    throw new IllegalArgumentException("'" + str + "' is not a valid date of pattern '" + pattern + "'", e);
  }
  return date;
}

代码示例来源:origin: org.apache.kylin/kylin-source-kafka

public DateTimeParser(Map<String, String> properties) {
  super(properties);
  tsPattern = properties.get(StreamingParser.PROPERTY_TS_PATTERN);
  try {
    formatter = org.apache.kylin.common.util.DateFormat.getDateFormat(tsPattern);
  } catch (Throwable e) {
    throw new IllegalStateException("Invalid tsPattern: '" + tsPattern + "'.");
  }
}

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

public static String formatToTimeStr(long millis) {
  return getDateFormat(DEFAULT_DATETIME_PATTERN_WITH_MILLISECONDS).format(new Date(millis));
}

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

public static String formatToDateStr(long millis, String pattern) {
  return getDateFormat(pattern).format(new Date(millis));
}

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

public static Date stringToDate(String str, String pattern) {
  Date date = null;
  try {
    date = getDateFormat(pattern).parse(str);
  } catch (ParseException e) {
    throw new IllegalArgumentException("'" + str + "' is not a valid date of pattern '" + pattern + "'", e);
  }
  return date;
}

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

public static String formatToDateStr(long millis, String pattern) {
  return getDateFormat(pattern).format(new Date(millis));
}

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

public static String formatToTimeStr(long millis, String pattern) {
  return getDateFormat(pattern).format(new Date(millis));
}

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

public static String dateToString(Date date, String pattern) {
  return getDateFormat(pattern).format(date);
}

相关文章