本文整理匯總了Java中java.time.ZonedDateTime.minusDays方法的典型用法代碼示例。如果您正苦於以下問題:Java ZonedDateTime.minusDays方法的具體用法?Java ZonedDateTime.minusDays怎麽用?Java ZonedDateTime.minusDays使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.time.ZonedDateTime
的用法示例。
在下文中一共展示了ZonedDateTime.minusDays方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: apply
import java.time.ZonedDateTime; //導入方法依賴的package包/類
@Override
public Expressie apply(final DatumLiteral datumLiteral, final GetalLiteral getalLiteral) {
Expressie resultaat = NullLiteral.INSTANCE;
if (datumLiteral.isVolledigBekend()) {
final ZonedDateTime dt = datumLiteral.alsDateTime();
resultaat = new DatumLiteral(dt.minusDays(getalLiteral.getWaarde()));
}
return resultaat;
}
示例2: load
import java.time.ZonedDateTime; //導入方法依賴的package包/類
private synchronized void load(int year) {
if (alreadyLoadedYears.contains(year)) {
return;
}
alreadyLoadedYears.add(year);
ZonedDateTime st = ZonedDateTime.of(LocalDate.now().with(TemporalAdjusters.firstDayOfYear()), LocalTime.MIN, ZoneId.systemDefault());
ZonedDateTime et = ZonedDateTime.of(LocalDate.now().with(TemporalAdjusters.lastDayOfYear()), LocalTime.MAX, ZoneId.systemDefault());
try {
startBatchUpdates();
/*
* Convert start and end times from new java.time API to old API and then to ical API :-)
*/
Period period = new Period(
new DateTime(Date.from(st.toInstant())),
new DateTime(Date.from(et.toInstant())));
Rule[] rules = new Rule[]{new PeriodRule(period)};
Filter filter = new Filter(rules, Filter.MATCH_ANY);
@SuppressWarnings("unchecked")
Collection<VEvent> events = filter.filter(calendar.getComponents(Component.VEVENT));
for (VEvent evt : events) {
if (loadedEventIds.contains(evt.getUid())) {
continue;
}
loadedEventIds.add(evt.getUid());
ICalCalendarEntry entry = new ICalCalendarEntry(evt);
ZonedDateTime entryStart = ZonedDateTime.ofInstant(evt.getStartDate().getDate().toInstant(), ZoneId.systemDefault());
ZonedDateTime entryEnd = ZonedDateTime.ofInstant(evt
.getEndDate().getDate().toInstant(),
ZoneId.systemDefault());
if (entryEnd.toLocalDate().isAfter(entryStart.toLocalDate())) {
entryEnd = entryEnd.minusDays(1);
entry.setFullDay(true);
}
entry.setInterval(new Interval(entryStart, entryEnd));
final Property prop = evt.getProperty("RRULE");
if (prop instanceof RRule) {
RRule rrule = (RRule) prop;
entry.setRecurrenceRule("RRULE:" + rrule.getValue());
}
addEntry(entry);
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
stopBatchUpdates();
}
}