本文整理了Java中org.geotools.feature.type.DateUtil.formatYearMonthDay()
方法的一些代码示例,展示了DateUtil.formatYearMonthDay()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateUtil.formatYearMonthDay()
方法的具体详情如下:
包路径:org.geotools.feature.type.DateUtil
类名称:DateUtil
方法名:formatYearMonthDay
[英]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.
[中]将时间(以毫秒为单位)格式化为年数、月数和日数。生成的年号格式与W3C XML模式定义一致,年最少使用四位数字,月和日各使用两位数字。
代码示例来源:origin: geotools/geotools
/**
* Serialize time to general date text. Date values are formatted in W3C XML Schema standard
* format as CCYY-MM-DD, with optional leading sign included if necessary.
*
* @param time time to be converted, as milliseconds from January 1, 1970
* @return converted date text
* @throws IllegalArgumentException on conversion error
*/
public static String serializeDate(long time) throws IllegalArgumentException {
StringBuffer buff = new StringBuffer(12);
formatYearMonthDay(time + TIME_BASE, buff);
return buff.toString();
}
代码示例来源: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 general date text. Date values are formatted in W3C
* XML Schema standard format as CCYY-MM-DD, with optional leading sign
* included if necessary.
*
* @param time time to be converted, as milliseconds from January 1, 1970
*
* @return converted date text
*
* @throws IllegalArgumentException on conversion error
*/
public static String serializeDate(long time)
throws IllegalArgumentException {
StringBuffer buff = new StringBuffer(12);
formatYearMonthDay(time + TIME_BASE, buff);
return buff.toString();
}
代码示例来源:origin: org.geotools/gt2-main
/**
* Serialize time to general date text. Date values are formatted in W3C
* XML Schema standard format as CCYY-MM-DD, with optional leading sign
* included if necessary.
*
* @param time time to be converted, as milliseconds from January 1, 1970
*
* @return converted date text
*
* @throws IllegalArgumentException on conversion error
*/
public static String serializeDate(long time)
throws IllegalArgumentException {
StringBuffer buff = new StringBuffer(12);
formatYearMonthDay(time + TIME_BASE, buff);
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 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/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();
}
内容来源于网络,如有侵权,请联系作者删除!