List of usage examples for java.util Date toInstant
public Instant toInstant()
From source file:Main.java
public static void main(String[] args) { java.util.Date currentDate = new java.util.Date(); Instant i = currentDate.toInstant(); System.out.println(i);//from ww w . jav a 2 s . c o m }
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); System.out.println(localDateTime); }
From source file:Main.java
public static void main(String[] args) { Date dt = new Date(); System.out.println("Date: " + dt); Instant in = dt.toInstant(); System.out.println("Instant: " + in); Date dt2 = Date.from(in); System.out.println("Date: " + dt2); }
From source file:Main.java
public static LocalDate asLocalDateIn(Date date, ZoneId timeZone) { return date.toInstant().atZone(timeZone).toLocalDate(); }
From source file:Main.java
public static LocalDate asLocalDateInUTC(Date date) { ZoneId UTC = ZoneId.of("Z"); return date.toInstant().atZone(UTC).toLocalDate(); }
From source file:Main.java
public static LocalDate toLocalDate(Date date) { Date lDate = new Date(date.getTime()); return lDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); }
From source file:com.rcs.shoe.shop.fx.utils.DateUtils.java
public static LocalDate convert(Date date) { Instant instant = date.toInstant(); return instant.atZone(ZoneId.systemDefault()).toLocalDate(); }
From source file:Main.java
public static ZonedDateTime toZonedDateTime(Date utilDate) { if (utilDate == null) { return null; }/*from w ww .j a v a 2 s . c om*/ final ZoneId systemDefault = ZoneId.systemDefault(); return ZonedDateTime.ofInstant(utilDate.toInstant(), systemDefault); }
From source file:com.hengyi.japp.tools.DateTimeUtil.java
public static LocalDateTime toLocalDateTime(Date date) { return date == null ? null : LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); }
From source file:oauth2.authentication.approvals.ApprovalServiceImpl.java
private static Instant toInstant(Date date) { if (date == null) { return null; }// www . j av a2 s . co m return date.toInstant(); }