本文整理匯總了Java中org.joda.time.PeriodType.dayTime方法的典型用法代碼示例。如果您正苦於以下問題:Java PeriodType.dayTime方法的具體用法?Java PeriodType.dayTime怎麽用?Java PeriodType.dayTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.joda.time.PeriodType
的用法示例。
在下文中一共展示了PeriodType.dayTime方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getLeft
import org.joda.time.PeriodType; //導入方法依賴的package包/類
public String getLeft(int next, boolean showsecs) {
LocalDateTime date = getTimeCal(null, next);
Period period = new Period(LocalDateTime.now(), date, PeriodType.dayTime());
if (showsecs) {
return Utils.toArabicNrs(PERIOD_FORMATTER_HMS.print(period));
} else if (Prefs.isDefaultWidgetMinuteType()) {
return Utils.toArabicNrs(PERIOD_FORMATTER_HM.print(period));
} else {
period = period.withFieldAdded(DurationFieldType.minutes(), 1);
return Utils.toArabicNrs(PERIOD_FORMATTER_HM.print(period));
}
}
示例2: getTimeLeft
import org.joda.time.PeriodType; //導入方法依賴的package包/類
ProjectTime getTimeLeft(DateTime now) {
if (now.isAfter(deadline)) {
// TODO: add successful.
return new ProjectTime("ENDED", deadline.toString());
}
Period period = new Period(now, deadline, PeriodType.dayTime());
return PeriodToStringConverter.periodToProjectTime(period);
}
示例3: testParsePeriod_parseType
import org.joda.time.PeriodType; //導入方法依賴的package包/類
public void testParsePeriod_parseType() {
Period expect = new Period(0, 0, 0, 4, 5, 6, 7, 8, PeriodType.dayTime());
assertEquals(expect, f.withParseType(PeriodType.dayTime()).parsePeriod("P4DT5H6M7.008S"));
try {
f.withParseType(PeriodType.dayTime()).parsePeriod("P3W4DT5H6M7.008S");
fail();
} catch (IllegalArgumentException ex) {}
}
示例4: periodTest
import org.joda.time.PeriodType; //導入方法依賴的package包/類
@Test
public void periodTest() {
long duration = Double.valueOf(200000 * DateTimeConstants.MILLIS_PER_SECOND).longValue();
MutablePeriod p = new MutablePeriod(duration, PeriodType.dayTime());
String s = periodFormatter.print(p);
System.out.println(s);
}
示例5: periodBetween
import org.joda.time.PeriodType; //導入方法依賴的package包/類
/**
* 兩個日期範圍間隔
* @param startDate
* @param endDate
* @return
*/
public static Period periodBetween(Date startDate, Date endDate) {
DateTime start = new DateTime(startDate.getTime());
DateTime end = new DateTime(endDate.getTime());
return new Period(start, end, PeriodType.dayTime());
}