本文整理匯總了Java中org.joda.time.format.ISODateTimeFormat.time方法的典型用法代碼示例。如果您正苦於以下問題:Java ISODateTimeFormat.time方法的具體用法?Java ISODateTimeFormat.time怎麽用?Java ISODateTimeFormat.time使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.joda.time.format.ISODateTimeFormat
的用法示例。
在下文中一共展示了ISODateTimeFormat.time方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
示例3: writeTime
import org.joda.time.format.ISODateTimeFormat; //導入方法依賴的package包/類
@Override
public void writeTime(boolean isNull) throws IOException {
TimeWriter t = writer.time();
if(!isNull){
DateTimeFormatter f = ISODateTimeFormat.time();
t.writeTime((int) ((f.parseDateTime(parser.getValueAsString())).withZoneRetainFields(org.joda.time.DateTimeZone.UTC).getMillis()));
}
}
示例4: writeTime
import org.joda.time.format.ISODateTimeFormat; //導入方法依賴的package包/類
@Override
public void writeTime(boolean isNull) throws IOException {
TimeMilliWriter t = writer.timeMilli();
if(!isNull){
DateTimeFormatter f = ISODateTimeFormat.time();
t.writeTimeMilli((int) com.dremio.common.util.DateTimes.toMillis(f.parseLocalDateTime(parser.getValueAsString())));
}
}