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


Java DateTimeUtils.getIntervalChronology方法代碼示例

本文整理匯總了Java中org.joda.time.DateTimeUtils.getIntervalChronology方法的典型用法代碼示例。如果您正苦於以下問題:Java DateTimeUtils.getIntervalChronology方法的具體用法?Java DateTimeUtils.getIntervalChronology怎麽用?Java DateTimeUtils.getIntervalChronology使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.joda.time.DateTimeUtils的用法示例。


在下文中一共展示了DateTimeUtils.getIntervalChronology方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: BasePeriod

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
 * Creates a period from the given interval endpoints.
 *
 * @param startInstant  interval start, null means now
 * @param endInstant  interval end, null means now
 * @param type  which set of fields this period supports, null means standard
 * @throws IllegalArgumentException if period type is invalid
 */
protected BasePeriod(ReadableInstant startInstant, ReadableInstant endInstant, PeriodType type) {
    super();
    type = checkPeriodType(type);
    if (startInstant == null && endInstant == null) {
        iType = type;
        iValues = new int[size()];
    } else {
        long startMillis = DateTimeUtils.getInstantMillis(startInstant);
        long endMillis = DateTimeUtils.getInstantMillis(endInstant);
        Chronology chrono = DateTimeUtils.getIntervalChronology(startInstant, endInstant);
        iType = type;
        iValues = chrono.get(this, startMillis, endMillis);
    }
}
 
開發者ID:redfish64,項目名稱:TinyTravelTracker,代碼行數:23,代碼來源:BasePeriod.java

示例2: setInto

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
 * Sets the values of the mutable duration from the specified interval.
 * 
 * @param writablePeriod  the period to modify
 * @param object  the interval to set from
 * @param chrono  the chronology to use
 */
public void setInto(ReadWritablePeriod writablePeriod, Object object, Chronology chrono) {
    ReadableInterval interval = (ReadableInterval) object;
    chrono = (chrono != null ? chrono : DateTimeUtils.getIntervalChronology(interval));
    long start = interval.getStartMillis();
    long end = interval.getEndMillis();
    int[] values = chrono.get(writablePeriod, start, end);
    for (int i = 0; i < values.length; i++) {
        writablePeriod.setValue(i, values[i]);
    }
}
 
開發者ID:redfish64,項目名稱:TinyTravelTracker,代碼行數:18,代碼來源:ReadableIntervalConverter.java


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