DateFunctionsUtils.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:dremio-oss 作者:
public static DateTimeFormatter getFormatterForFormatString(final String formatString) {
  String jodaString = null;
  try {
    jodaString = JodaDateValidator.toJodaFormat(formatString);
  } catch (ParseException e) {
    throw UserException.functionError(e)
      .message("Failure parsing the formatting string at column %d of: %s", e.getErrorOffset(), formatString)
      .addContext("Details", e.getMessage())
      .addContext("Format String", formatString)
      .addContext("Error Offset", e.getErrorOffset())
      .build(logger);
  }

  try {
    return DateTimeFormat.forPattern(jodaString).withZoneUTC();
  } catch (IllegalArgumentException ex) {
    throw UserException.functionError(ex)
      .message("Invalid formatting string")
      .addContext("Details", ex.getMessage())
      .addContext("Format String", formatString)
      .build(logger);
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号