本文整理了Java中org.geotools.feature.type.DateUtil.parseDateTime()
方法的一些代码示例,展示了DateUtil.parseDateTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateUtil.parseDateTime()
方法的具体详情如下:
包路径:org.geotools.feature.type.DateUtil
类名称:DateUtil
方法名:parseDateTime
[英]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.
[中]
代码示例来源:origin: geotools/geotools
/**
* Deserialize date from general dateTime text. Date values are expected to match W3C XML Schema
* standard format as CCYY-MM-DDThh:mm:ss, with optional leading minus sign and trailing seconds
* decimal, as necessary. 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 date, or <code>null</code> if passed <code>null</code> input
* @throws IllegalArgumentException on parse error
*/
public static Date deserializeDateTime(String text) throws IllegalArgumentException {
if (text == null) {
return null;
} else {
return new Date(parseDateTime(text));
}
}
代码示例来源:origin: geotools/geotools
Timestamp stamp = new Timestamp(parseDateTime(text));
stamp.setNanos(nano);
代码示例来源:origin: org.geotools/gt-main
/**
* Deserialize date from general dateTime text. Date values are expected to
* match W3C XML Schema standard format as CCYY-MM-DDThh:mm:ss, with
* optional leading minus sign and trailing seconds decimal, as necessary.
* 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 date, or <code>null</code> if passed <code>null</code>
* input
*
* @throws IllegalArgumentException on parse error
*/
public static Date deserializeDateTime(String text)
throws IllegalArgumentException {
if (text == null) {
return null;
} else {
return new Date(parseDateTime(text));
}
}
代码示例来源:origin: org.geotools/gt2-main
/**
* Deserialize date from general dateTime text. Date values are expected to
* match W3C XML Schema standard format as CCYY-MM-DDThh:mm:ss, with
* optional leading minus sign and trailing seconds decimal, as necessary.
* 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 date, or <code>null</code> if passed <code>null</code>
* input
*
* @throws IllegalArgumentException on parse error
*/
public static Date deserializeDateTime(String text)
throws IllegalArgumentException {
if (text == null) {
return null;
} else {
return new Date(parseDateTime(text));
}
}
代码示例来源:origin: org.geotools/gt-main
Timestamp stamp = new Timestamp(parseDateTime(text));
stamp.setNanos(nano);
代码示例来源:origin: org.geotools/gt2-main
Timestamp stamp = new Timestamp(parseDateTime(text));
stamp.setNanos(nano);
代码示例来源:origin: org.geoserver/gs-wms
} else {
try {
dateToMatch = new Date(DateUtil.parseDateTime(this.toMatch.toString()));
} catch (IllegalArgumentException e) {
throw new ServiceException(
代码示例来源:origin: org.geoserver/gs-wms
if (referenceValue != null) {
try {
refValue = new Date(DateUtil.parseDateTime(referenceValue));
} catch (IllegalArgumentException e) {
try {
if (referenceValue != null) {
try {
refValue = new Date(DateUtil.parseDateTime(referenceValue));
} catch (IllegalArgumentException e) {
try {
代码示例来源:origin: org.geoserver/gs-wms
} else {
try {
refDate = new Date(DateUtil.parseDateTime(referenceValue));
} catch (IllegalArgumentException e) {
throw new ServiceException(
代码示例来源:origin: org.geoserver/gs-wms
@Test
public void testExplicitFixedTimeCoverageSelector() throws Exception {
String fixedTimeStr = "2012-06-01T03:00:00.000Z";
// Use explicit default value strategy:
DimensionDefaultValueSetting defaultValueSetting = new DimensionDefaultValueSetting();
defaultValueSetting.setStrategyType(Strategy.FIXED);
defaultValueSetting.setReferenceValue(fixedTimeStr);
setupResourceDimensionDefaultValue(WATTEMP_FUTURE, ResourceInfo.TIME, defaultValueSetting);
long fixedTime = DateUtil.parseDateTime(fixedTimeStr);
CoverageInfo coverage = getCatalog().getCoverageByName(WATTEMP_FUTURE.getLocalPart());
java.util.Date d = (java.util.Date) wms.getDefaultTime(coverage);
assertTrue("Returns a valid Default time", d != null);
assertTrue("Default time should be the fixed one", d.getTime() == fixedTime);
}
代码示例来源:origin: org.geoserver/gs-wms
getCatalog().getFeatureTypeByName(TIME_ELEVATION_CUSTOM.getLocalPart());
long fixed = DateUtil.parseDateTime(fixedStr);
代码示例来源:origin: org.geoserver/gs-wms
@Test
public void testExplicitFixedTimeVectorSelector() throws Exception {
int fid = 1000;
String fixedTimeStr = "2012-06-01T03:00:00.000Z";
// Use explicit default value DimensionInfo setup:
DimensionDefaultValueSetting defaultValueSetting = new DimensionDefaultValueSetting();
defaultValueSetting.setStrategyType(Strategy.FIXED);
defaultValueSetting.setReferenceValue(fixedTimeStr);
long fixedTime = DateUtil.parseDateTime(fixedTimeStr);
setupFeatureTimeDimension(defaultValueSetting);
FeatureTypeInfo timeWithStartEnd =
getCatalog().getFeatureTypeByName(TIME_WITH_START_END.getLocalPart());
Date twoDaysAgo = addFeatureWithTimeTwoDaysAgo(fid++);
this.addFeature(fid++, twoDaysAgo, Double.valueOf(0d));
java.util.Date d = (java.util.Date) wms.getDefaultTime(timeWithStartEnd);
assertTrue("Default time is null", d != null);
assertTrue("Default time should be the fixed one", d.getTime() == fixedTime);
// Add some features with timestamps in the future:
addFeatureWithTimeDayAfterTomorrow(fid++);
addFeatureWithTimeOneYearFromNow(fid++);
d = (java.util.Date) wms.getDefaultTime(timeWithStartEnd);
assertTrue("Default time is null", d != null);
assertTrue("Default time should be the fixed one", d.getTime() == fixedTime);
addFeatureWithTimeTodayMidnight(fid++);
d = (java.util.Date) wms.getDefaultTime(timeWithStartEnd);
assertTrue("Default time is null", d != null);
assertTrue("Default time should be the fixed one", d.getTime() == fixedTime);
}
内容来源于网络,如有侵权,请联系作者删除!