本文整理汇总了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();
}
}