org.geotools.feature.type.DateUtil.parseTime()方法的使用及代码示例

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

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

DateUtil.parseTime介绍

[英]Parse general time value from text. Time values are expected to be in W3C XML Schema standard format as hh:mm:ss.fff, with optional leading sign and trailing time zone.
[中]从文本中解析常规时间值。时间值应为W3CXML模式标准格式,格式为hh:mm:ss。fff,带有可选的前导符号和尾随时区。

代码示例

代码示例来源:origin: geotools/geotools

/**
 * Deserialize time from text. Time values obey the rules of the time portion of a dataTime
 * value. This method follows standard JiBX deserializer usage requirements by accepting a
 * <code>null</code> input.
 *
 * @param text text to be parsed (may be <code>null</code>)
 * @return converted time, or <code>null</code> if passed <code>null</code> input
 * @throws IllegalArgumentException on parse error
 */
public static Time deserializeSqlTime(String text) throws IllegalArgumentException {
  if (text == null) {
    return null;
  } else {
    return new Time(parseTime(text, 0, text.length()));
  }
}

代码示例来源:origin: geotools/geotools

/**
 * Parse general dateTime value from text. Date values are expected to be in W3C XML Schema
 * standard format as CCYY-MM-DDThh:mm:ss.fff, with optional leading sign and trailing time
 * zone.
 *
 * @param text text to be parsed
 * @return converted date as millisecond value
 * @throws IllegalArgumentException on parse error
 */
public static long parseDateTime(String text) throws IllegalArgumentException {
  // split text to convert portions separately
  int split = text.indexOf('T');
  if (split < 0) {
    throw new IllegalArgumentException("Missing 'T' separator in dateTime");
  }
  return parseDate(text.substring(0, split)) + parseTime(text, split + 1, text.length());
}

代码示例来源:origin: org.geotools/gt-main

/**
 * Deserialize time from text. Time values obey the rules of the time
 * portion of a dataTime value. This method follows standard JiBX
 * deserializer usage requirements by accepting a <code>null</code> input.
 *
 * @param text text to be parsed (may be <code>null</code>)
 *
 * @return converted time, or <code>null</code> if passed <code>null</code>
 *         input
 *
 * @throws IllegalArgumentException on parse error
 */
public static Time deserializeSqlTime(String text)
  throws IllegalArgumentException {
  if (text == null) {
    return null;
  } else {
    return new Time(parseTime(text, 0, text.length()));
  }
}

代码示例来源:origin: org.geotools/gt2-main

/**
 * Deserialize time from text. Time values obey the rules of the time
 * portion of a dataTime value. This method follows standard JiBX
 * deserializer usage requirements by accepting a <code>null</code> input.
 *
 * @param text text to be parsed (may be <code>null</code>)
 *
 * @return converted time, or <code>null</code> if passed <code>null</code>
 *         input
 *
 * @throws IllegalArgumentException on parse error
 */
public static Time deserializeSqlTime(String text)
  throws IllegalArgumentException {
  if (text == null) {
    return null;
  } else {
    return new Time(parseTime(text, 0, text.length()));
  }
}

代码示例来源:origin: org.geotools/gt-main

/**
 * Parse general dateTime value from text. Date values are expected to be
 * in W3C XML Schema standard format as CCYY-MM-DDThh:mm:ss.fff, with
 * optional leading sign and trailing time zone.
 *
 * @param text text to be parsed
 *
 * @return converted date as millisecond value
 *
 * @throws IllegalArgumentException on parse error
 */
public static long parseDateTime(String text)
  throws IllegalArgumentException {
  // split text to convert portions separately
  int split = text.indexOf('T');
  if (split < 0) {
    throw new IllegalArgumentException(
      "Missing 'T' separator in dateTime");
  }
  return parseDate(text.substring(0, split))
  + parseTime(text, split + 1, text.length());
}

代码示例来源:origin: org.geotools/gt2-main

/**
 * Parse general dateTime value from text. Date values are expected to be
 * in W3C XML Schema standard format as CCYY-MM-DDThh:mm:ss.fff, with
 * optional leading sign and trailing time zone.
 *
 * @param text text to be parsed
 *
 * @return converted date as millisecond value
 *
 * @throws IllegalArgumentException on parse error
 */
public static long parseDateTime(String text)
  throws IllegalArgumentException {
  // split text to convert portions separately
  int split = text.indexOf('T');
  if (split < 0) {
    throw new IllegalArgumentException(
      "Missing 'T' separator in dateTime");
  }
  return parseDate(text.substring(0, split))
  + parseTime(text, split + 1, text.length());
}

相关文章