List of usage examples for java.time LocalDateTime getDayOfWeek
public DayOfWeek getDayOfWeek()
From source file:Main.java
public static void main(String[] args) { LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 01); System.out.println(a.getDayOfWeek().name()); }
From source file:org.thevortex.lighting.jinks.robot.Recurrence.java
/** * Get the next occurrence from a time.// ww w . j a v a 2 s . c o m * * @param fromWhen when * @return the next occurrence or {@code null} if there is no more */ public LocalDateTime nextOccurrence(TemporalAccessor fromWhen) { LocalDateTime from = LocalDateTime.from(fromWhen); // if it's not today, try the next day if (frequency == Frequency.WEEKLY && !days.contains(from.getDayOfWeek())) { return nextOccurrence(from.plusDays(1).truncatedTo(ChronoUnit.DAYS)); } // if we've already started, it's too late - next day if (from.toLocalTime().isAfter(startTime)) { return nextOccurrence(from.plusDays(1).truncatedTo(ChronoUnit.DAYS)); } // otherwise, we're on the right day, so just adjust the time return from.with(startTime).truncatedTo(ChronoUnit.MINUTES); }
From source file:msi.gama.util.GamaDate.java
public IList<?> listValue(final IScope scope, final IType<?> ct) { final LocalDateTime ld = LocalDateTime.from(internal); return GamaListFactory.create(scope, ct, ld.getYear(), ld.getMonthValue(), ld.getDayOfWeek().getValue(), ld.getHour(), ld.getMinute(), ld.getSecond()); }