List of usage examples for java.time ZonedDateTime withYear
public ZonedDateTime withYear(int year)
From source file:Main.java
public static void main(String[] args) { ZonedDateTime dateTime = ZonedDateTime.now(); dateTime = dateTime.withYear(2000); System.out.println(dateTime); }
From source file:sorcer.file.ScratchDirManager.java
private boolean isCutoffTime(Path path, long cutOffTime) throws IOException { ZonedDateTime now = ZonedDateTime.now(); BasicFileAttributes attrs = Files.readAttributes(path, BasicFileAttributes.class); ZonedDateTime created = ZonedDateTime.ofInstant(attrs.creationTime().toInstant(), now.getZone()); created = created.withYear(now.getYear()).withMonth(now.getMonthValue()); ZonedDateTime cutoff = created.plus(cutOffTime, MILLIS); log.info("Created {}", created); log.info("now {}", now); log.info("cutoff {}", cutoff); return now.isAfter(cutoff); }