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

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

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

DateUtil.serializeSqlDate介绍

[英]Serialize SQL date 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.
[中]将SQL日期序列化为常规日期文本。日期值的格式为W3C XML模式标准格式CCYY-MM-DD,必要时包括可选的前导符号。

代码示例

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

public void testSqlDate() {
  Calendar cal = Calendar.getInstance();
  cal.clear();
  cal.set(2007, 3, 1, 1, 15);
  Date time = cal.getTime();
  java.sql.Date date = new java.sql.Date(time.getTime());
  String dateTime = DateUtil.serializeSqlDate(date);
  assertEquals("2007-04-01", dateTime);
}

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

String text = null;
if (value instanceof java.sql.Date)
  text = DateUtil.serializeSqlDate((java.sql.Date) value);
else if (value instanceof java.sql.Time)
  text = DateUtil.serializeSqlTime((java.sql.Time) value);

代码示例来源:origin: org.geoserver/gs-wfs

@Override
  public String format(Object att) {
    return prepCSVField(DateUtil.serializeSqlDate((java.sql.Date) att));
  }
}

代码示例来源:origin: org.geoserver/gs-wfs

private String formatToString(Object att, NumberFormat coordFormatter) {
  String value;
  if (att instanceof Number) {
    // don't allow scientific notation in the output, as OpenOffice won't
    // recognize that as a number
    value = coordFormatter.format(att);
  } else if (att instanceof Date) {
    // serialize dates in ISO format
    if (att instanceof java.sql.Date)
      value = DateUtil.serializeSqlDate((java.sql.Date) att);
    else if (att instanceof java.sql.Time)
      value = DateUtil.serializeSqlTime((java.sql.Time) att);
    else value = DateUtil.serializeDateTime((Date) att);
  } else {
    // everything else we just "toString"
    value = att.toString();
  }
  return value;
}

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

String text = null;
if(value instanceof java.sql.Date)
  text = DateUtil.serializeSqlDate((java.sql.Date) value);
else if(value instanceof java.sql.Time)
  text = DateUtil.serializeSqlTime((java.sql.Time) value);

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

String text = null;
if(value instanceof java.sql.Date)
  text = DateUtil.serializeSqlDate((java.sql.Date) value);
else if(value instanceof java.sql.Time)
  text = DateUtil.serializeSqlTime((java.sql.Time) value);

相关文章