本文整理匯總了Java中org.joda.time.PeriodType.yearMonthDayTime方法的典型用法代碼示例。如果您正苦於以下問題:Java PeriodType.yearMonthDayTime方法的具體用法?Java PeriodType.yearMonthDayTime怎麽用?Java PeriodType.yearMonthDayTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.joda.time.PeriodType
的用法示例。
在下文中一共展示了PeriodType.yearMonthDayTime方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testSetInto_Object
import org.joda.time.PeriodType; //導入方法依賴的package包/類
public void testSetInto_Object() throws Exception {
MutablePeriod m = new MutablePeriod(PeriodType.yearMonthDayTime());
ReadableDurationConverter.INSTANCE.setInto(m, new Duration(
3L * DateTimeConstants.MILLIS_PER_DAY +
4L * DateTimeConstants.MILLIS_PER_MINUTE + 5L
), null);
assertEquals(0, m.getYears());
assertEquals(0, m.getMonths());
assertEquals(0, m.getWeeks());
assertEquals(0, m.getDays());
assertEquals(3 * 24, m.getHours());
assertEquals(4, m.getMinutes());
assertEquals(0, m.getSeconds());
assertEquals(5, m.getMillis());
}
示例2: testSetIntoPeriod_Object1
import org.joda.time.PeriodType; //導入方法依賴的package包/類
public void testSetIntoPeriod_Object1() throws Exception {
MutablePeriod m = new MutablePeriod(PeriodType.yearMonthDayTime());
StringConverter.INSTANCE.setInto(m, "P2Y6M9DT12H24M48S", null);
assertEquals(2, m.getYears());
assertEquals(6, m.getMonths());
assertEquals(9, m.getDays());
assertEquals(12, m.getHours());
assertEquals(24, m.getMinutes());
assertEquals(48, m.getSeconds());
assertEquals(0, m.getMillis());
}
示例3: testSetInto_Object
import org.joda.time.PeriodType; //導入方法依賴的package包/類
public void testSetInto_Object() throws Exception {
MutablePeriod m = new MutablePeriod(PeriodType.yearMonthDayTime());
ReadablePeriodConverter.INSTANCE.setInto(m, new Period(0, 0, 0, 3, 0, 4, 0, 5), null);
assertEquals(0, m.getYears());
assertEquals(0, m.getMonths());
assertEquals(0, m.getWeeks());
assertEquals(3, m.getDays());
assertEquals(0, m.getHours());
assertEquals(4, m.getMinutes());
assertEquals(0, m.getSeconds());
assertEquals(5, m.getMillis());
}
示例4: getDateDifference
import org.joda.time.PeriodType; //導入方法依賴的package包/類
/**
* Returns time difference
*
* @param d1
* @param d2
* @return
*/
public static String getDateDifference(Date d1, Date d2) {
Period period = new Period(new DateTime(d1), new DateTime(d2),
PeriodType.yearMonthDayTime());
return PERIOD_FORMATTER.print(period);
}