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

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

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

DateUtil.serializeTime介绍

[英]Serialize time to general time text in buffer. Time values are formatted in W3C XML Schema standard format as hh:mm:ss, with optional trailing seconds decimal, as necessary. This form uses a supplied buffer to support flexible use, including with dateTime combination values.
[中]将缓冲区中的时间序列化为常规时间文本。时间值以W3CXMLSchema标准格式格式化为hh:mm:ss,并根据需要使用可选的尾随秒十进制。此表单使用提供的缓冲区来支持灵活的使用,包括日期时间组合值。

代码示例

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

/**
 * Serialize time to standard text. Time values are formatted in W3C XML Schema standard format
 * as hh:mm:ss, with optional trailing seconds decimal, as necessary. The standard conversion
 * does not append a time zone indication.
 *
 * @param time time to be converted
 * @return converted time text
 * @throws IllegalArgumentException on conversion error
 */
public static String serializeSqlTime(Time time) throws IllegalArgumentException {
  StringBuffer buff = new StringBuffer(12);
  long t = time.getTime();
  t += TimeZone.getDefault().getOffset(t);
  int extra = formatYearMonthDay(t + TIME_BASE, buff);
  buff.delete(0, buff.length());
  serializeTime(extra, buff);
  return buff.toString();
}

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

/**
 * Serialize time to general dateTime text. Date values are formatted in W3C XML Schema standard
 * format as CCYY-MM-DDThh:mm:ss, with optional leading sign and trailing seconds decimal, as
 * necessary.
 *
 * @param time time to be converted, as milliseconds from January 1, 1970
 * @param zone flag for trailing 'Z' to be appended to indicate UTC
 * @return converted dateTime text
 * @throws IllegalArgumentException on conversion error
 */
public static String serializeDateTime(long time, boolean zone)
    throws IllegalArgumentException {
  // start with the year, month, and day
  StringBuffer buff = new StringBuffer(25);
  int extra = formatYearMonthDay(time + TIME_BASE, buff);
  // append the time for full form
  buff.append('T');
  serializeTime(extra, buff);
  // return full text with optional trailing zone indicator
  if (zone) {
    buff.append('Z');
  }
  return buff.toString();
}

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

/**
 * Serialize time to standard text. Time values are formatted in W3C XML
 * Schema standard format as hh:mm:ss, with optional trailing seconds
 * decimal, as necessary. The standard conversion does not append a time
 * zone indication.
 *
 * @param time time to be converted
 *
 * @return converted time text
 *
 * @throws IllegalArgumentException on conversion error
 */
public static String serializeSqlTime(Time time)
  throws IllegalArgumentException {
  StringBuffer buff = new StringBuffer(12);
  long t = time.getTime();       
  t += TimeZone.getDefault().getOffset(t);
  int extra = formatYearMonthDay(t + TIME_BASE, buff);
  buff.delete(0, buff.length());
  serializeTime(extra, buff);
  return buff.toString();
}

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

/**
 * Serialize time to general dateTime text. Date values are formatted in
 * W3C XML Schema standard format as CCYY-MM-DDThh:mm:ss, with optional
 * leading sign and trailing seconds decimal, as necessary.
 *
 * @param time time to be converted, as milliseconds from January 1, 1970
 * @param zone flag for trailing 'Z' to be appended to indicate UTC
 *
 * @return converted dateTime text
 *
 * @throws IllegalArgumentException on conversion error
 */
public static String serializeDateTime(long time, boolean zone)
  throws IllegalArgumentException {
  // start with the year, month, and day
  StringBuffer buff = new StringBuffer(25);
  int extra = formatYearMonthDay(time + TIME_BASE, buff);
  // append the time for full form
  buff.append('T');
  serializeTime(extra, buff);
  // return full text with optional trailing zone indicator
  if (zone) {
    buff.append('Z');
  }
  return buff.toString();
}

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

/**
 * Serialize time to standard text. Time values are formatted in W3C XML
 * Schema standard format as hh:mm:ss, with optional trailing seconds
 * decimal, as necessary. The standard conversion does not append a time
 * zone indication.
 *
 * @param time time to be converted
 *
 * @return converted time text
 *
 * @throws IllegalArgumentException on conversion error
 */
public static String serializeSqlTime(Time time)
  throws IllegalArgumentException {
  StringBuffer buff = new StringBuffer(12);
  long t = time.getTime();       
  t += TimeZone.getDefault().getOffset(t);
  int extra = formatYearMonthDay(t + TIME_BASE, buff);
  buff.delete(0, buff.length());
  serializeTime(extra, buff);
  return buff.toString();
}

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

/**
 * Serialize time to general dateTime text. Date values are formatted in
 * W3C XML Schema standard format as CCYY-MM-DDThh:mm:ss, with optional
 * leading sign and trailing seconds decimal, as necessary.
 *
 * @param time time to be converted, as milliseconds from January 1, 1970
 * @param zone flag for trailing 'Z' to be appended to indicate UTC
 *
 * @return converted dateTime text
 *
 * @throws IllegalArgumentException on conversion error
 */
public static String serializeDateTime(long time, boolean zone)
  throws IllegalArgumentException {
  // start with the year, month, and day
  StringBuffer buff = new StringBuffer(25);
  int extra = formatYearMonthDay(time + TIME_BASE, buff);
  // append the time for full form
  buff.append('T');
  serializeTime(extra, buff);
  // return full text with optional trailing zone indicator
  if (zone) {
    buff.append('Z');
  }
  return buff.toString();
}

相关文章