本文整理汇总了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())));
}
}