本文整理匯總了Java中org.joda.time.format.ISODateTimeFormat.date方法的典型用法代碼示例。如果您正苦於以下問題:Java ISODateTimeFormat.date方法的具體用法?Java ISODateTimeFormat.date怎麽用?Java ISODateTimeFormat.date使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.joda.time.format.ISODateTimeFormat
的用法示例。
在下文中一共展示了ISODateTimeFormat.date方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: BasicJsonOutput
import org.joda.time.format.ISODateTimeFormat; //導入方法依賴的package包/類
protected BasicJsonOutput(JsonGenerator gen, DateOutputFormat dateOutput) {
Preconditions.checkNotNull(dateOutput);
Preconditions.checkNotNull(gen);
this.gen = gen;
switch (dateOutput) {
case SQL: {
dateFormatter = DateUtility.formatDate;
timeFormatter = DateUtility.formatTime;
timestampFormatter = DateUtility.formatTimeStamp;
break;
}
case ISO: {
dateFormatter = ISODateTimeFormat.date();
timeFormatter = ISODateTimeFormat.time();
timestampFormatter = ISODateTimeFormat.dateTime();
break;
}
default:
throw new UnsupportedOperationException(String.format("Unable to support date output of type %s.", dateOutput));
}
}
示例2: createDateTimeFormatter
import org.joda.time.format.ISODateTimeFormat; //導入方法依賴的package包/類
/**
* Create a new {@code DateTimeFormatter} using this factory.
* <p>If no specific pattern or style has been defined,
* the supplied {@code fallbackFormatter} will be used.
* @param fallbackFormatter the fall-back formatter to use when no specific
* factory properties have been set (can be {@code null}).
* @return a new date time formatter
*/
public DateTimeFormatter createDateTimeFormatter(DateTimeFormatter fallbackFormatter) {
DateTimeFormatter dateTimeFormatter = null;
if (StringUtils.hasLength(this.pattern)) {
dateTimeFormatter = DateTimeFormat.forPattern(this.pattern);
}
else if (this.iso != null && this.iso != ISO.NONE) {
switch (this.iso) {
case DATE:
dateTimeFormatter = ISODateTimeFormat.date();
break;
case TIME:
dateTimeFormatter = ISODateTimeFormat.time();
break;
case DATE_TIME:
dateTimeFormatter = ISODateTimeFormat.dateTime();
break;
case NONE:
/* no-op */
break;
default:
throw new IllegalStateException("Unsupported ISO format: " + this.iso);
}
}
else if (StringUtils.hasLength(this.style)) {
dateTimeFormatter = DateTimeFormat.forStyle(this.style);
}
if (dateTimeFormatter != null && this.timeZone != null) {
dateTimeFormatter = dateTimeFormatter.withZone(DateTimeZone.forTimeZone(this.timeZone));
}
return (dateTimeFormatter != null ? dateTimeFormatter : fallbackFormatter);
}