當前位置: 首頁>>代碼示例>>Java>>正文


Java ISODateTimeFormat.time方法代碼示例

本文整理匯總了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));
  }
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:25,代碼來源:BasicJsonOutput.java

示例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);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:41,代碼來源:DateTimeFormatterFactory.java

示例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()));
  }
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:9,代碼來源:VectorOutput.java

示例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())));
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:9,代碼來源:VectorOutput.java


注:本文中的org.joda.time.format.ISODateTimeFormat.time方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。