List of usage examples for java.time OffsetDateTime now
public static OffsetDateTime now()
From source file:Main.java
public static void main(String[] args) { OffsetDateTime o = OffsetDateTime.now(); Temporal d = o.adjustInto(OffsetDateTime.now(ZoneId.systemDefault())); System.out.println(d);//from w w w . ja v a 2s .c o m }
From source file:Main.java
public static void main(String[] args) { OffsetDateTime o = OffsetDateTime.now(); long d = o.until(OffsetDateTime.now(ZoneId.systemDefault()), ChronoUnit.WEEKS); System.out.println(d);//from w w w . j a v a 2 s . c o m }
From source file:Main.java
public static void main(String[] args) { OffsetDateTime o = OffsetDateTime.now(); LocalDate d = o.query(TemporalQueries.localDate()); System.out.println(d);//from ww w .j av a2s .com }
From source file:Main.java
public static void main(String[] args) { OffsetDateTime o = OffsetDateTime.now(); ValueRange l = o.range(ChronoField.DAY_OF_WEEK); System.out.println(l);// w ww . ja va 2s .co m }
From source file:Main.java
public static void main(String[] argv) { String ldStr = DateTimeFormatter.ISO_DATE.format(LocalDate.now()); System.out.println(ldStr);// w w w.j a v a 2 s . c o m String odtStr = DateTimeFormatter.ISO_DATE.format(OffsetDateTime.now()); System.out.println(odtStr); String zdtStr = DateTimeFormatter.ISO_DATE.format(ZonedDateTime.now()); System.out.println(zdtStr); }
From source file:Main.java
public static void main(String[] argv) { LocalDate ld = LocalDate.now(); String ldStr = ld.format(DateTimeFormatter.ISO_DATE); System.out.println("Local Date: " + ldStr); OffsetDateTime odt = OffsetDateTime.now(); String odtStr = odt.format(DateTimeFormatter.ISO_DATE); System.out.println("Offset Datetime: " + odtStr); ZonedDateTime zdt = ZonedDateTime.now(); String zdtStr = zdt.format(DateTimeFormatter.ISO_DATE); System.out.println("Zoned Datetime: " + zdtStr); }
From source file:Main.java
public static void main(String[] argv) { ZoneId INDIA = ZoneId.of("Asia/Kolkata"); LocalDateTime datetime = LocalDateTime.now(); ZoneOffset offset = ZoneOffset.of("+05:30"); OffsetDateTime date = OffsetDateTime.of(datetime, offset); System.out.println("OffsetDateTime.now() = " + OffsetDateTime.now()); System.out.println("OffsetDateTime.now(TimeZone.INDIA) = " + OffsetDateTime.now(INDIA)); System.out.println("Date and Time: " + datetime); System.out.println("Date and Time with timezone offset: " + date); }
From source file:org.jimsey.projects.turbine.condenser.web.SocketsController.java
@RequestMapping("/sockets") public String welcome(Map<String, Object> model) { model.put("time", OffsetDateTime.now()); // TODO replace with TickService // model.put("ticks", tickProcessor.getTicks()); // freemarker is used automatically if sockets.ftl exists... return "sockets"; }
From source file:de.kaiserpfalzEdv.office.core.security.impl.SecurityTicketHousekeeping.java
private Iterable<SecurityTicket> retrieveInvalideTickets() { OffsetDateTime now = OffsetDateTime.now(); LOG.debug("Checking tickets before: {}", now); return ticketRepository.findByValidityLessThan(now); }
From source file:keywhiz.api.ApiDate.java
public static ApiDate now() { return new ApiDate(OffsetDateTime.now().toEpochSecond()); }