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

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

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

DateUtil.formatYearMonth介绍

[英]Format time in milliseconds to year number and month number. The resulting year number format is consistent with W3C XML Schema definitions, using a minimum of four digits for the year and exactly two digits for the month.
[中]将时间(以毫秒为单位)格式化为年数和月数。生成的年号格式与W3C XML模式定义一致,年份至少使用四位数字,月份正好使用两位数字。

代码示例

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

/**
 * Serialize time to general gYearMonth text. Date values are formatted in W3C XML Schema
 * standard format as CCYY-MM, with optional leading sign included if necessary.
 *
 * @param time time to be converted, as milliseconds from January 1, 1970
 * @return converted gYearMonth text
 * @throws IllegalArgumentException on conversion error
 */
public static String serializeYearMonth(long time) throws IllegalArgumentException {
  StringBuffer buff = new StringBuffer(12);
  formatYearMonth(time + TIME_BASE, buff);
  return buff.toString();
}

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

/**
 * Format time in milliseconds to year number, month number, and day number. The resulting year
 * number format is consistent with W3C XML Schema definitions, using a minimum of four digits
 * for the year and exactly two digits each for the month and day.
 *
 * @param value time in milliseconds to be converted (from 1 C.E.)
 * @param buff text formatting buffer
 * @return number of milliseconds into day
 */
protected static int formatYearMonthDay(long value, StringBuffer buff) {
  // convert year and month
  long extra = formatYearMonth(value, buff);
  // append the day of month
  int day = (int) (extra / MSPERDAY) + 1;
  buff.append('-');
  formatTwoDigits(day, buff);
  // return excess of milliseconds into day
  return (int) (extra % MSPERDAY);
}

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

/**
 * Serialize time to general gYearMonth text. Date values are formatted in
 * W3C XML Schema standard format as CCYY-MM, with optional leading sign
 * included if necessary.
 *
 * @param time time to be converted, as milliseconds from January 1, 1970
 *
 * @return converted gYearMonth text
 *
 * @throws IllegalArgumentException on conversion error
 */
public static String serializeYearMonth(long time)
  throws IllegalArgumentException {
  StringBuffer buff = new StringBuffer(12);
  formatYearMonth(time + TIME_BASE, buff);
  return buff.toString();
}

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

/**
 * Serialize time to general gYearMonth text. Date values are formatted in
 * W3C XML Schema standard format as CCYY-MM, with optional leading sign
 * included if necessary.
 *
 * @param time time to be converted, as milliseconds from January 1, 1970
 *
 * @return converted gYearMonth text
 *
 * @throws IllegalArgumentException on conversion error
 */
public static String serializeYearMonth(long time)
  throws IllegalArgumentException {
  StringBuffer buff = new StringBuffer(12);
  formatYearMonth(time + TIME_BASE, buff);
  return buff.toString();
}

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

/**
 * Format time in milliseconds to year number, month number, and day
 * number. The resulting year number format is consistent with W3C XML
 * Schema definitions, using a minimum of four digits for the year and
 * exactly two digits each for the month and day.
 *
 * @param value time in milliseconds to be converted (from 1 C.E.)
 * @param buff text formatting buffer
 *
 * @return number of milliseconds into day
 */
protected static int formatYearMonthDay(long value, StringBuffer buff) {
  // convert year and month
  long extra = formatYearMonth(value, buff);
  // append the day of month
  int day = (int) (extra / MSPERDAY) + 1;
  buff.append('-');
  formatTwoDigits(day, buff);
  // return excess of milliseconds into day
  return (int) (extra % MSPERDAY);
}

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

/**
 * Format time in milliseconds to year number, month number, and day
 * number. The resulting year number format is consistent with W3C XML
 * Schema definitions, using a minimum of four digits for the year and
 * exactly two digits each for the month and day.
 *
 * @param value time in milliseconds to be converted (from 1 C.E.)
 * @param buff text formatting buffer
 *
 * @return number of milliseconds into day
 */
protected static int formatYearMonthDay(long value, StringBuffer buff) {
  // convert year and month
  long extra = formatYearMonth(value, buff);
  // append the day of month
  int day = (int) (extra / MSPERDAY) + 1;
  buff.append('-');
  formatTwoDigits(day, buff);
  // return excess of milliseconds into day
  return (int) (extra % MSPERDAY);
}

相关文章