List of usage examples for java.util Date from
public static Date from(Instant instant)
From source file:Main.java
public static void main(String[] args) { Date dt = Date.from(Instant.now()); System.out.println(dt); }
From source file:Main.java
public static void main(String[] argv) { Date dateFromInstant = Date.from(Instant.now()); System.out.println(dateFromInstant); java.util.TimeZone timeZone = java.util.TimeZone.getTimeZone(ZoneId.of("America/Los_Angeles")); System.out.println(timeZone); GregorianCalendar gregorianCalendar = GregorianCalendar.from(ZonedDateTime.now()); }
From source file:Main.java
public static void main(String[] args) { Date dt = new Date(); System.out.println("Date: " + dt); Instant in = dt.toInstant();//from ww w . ja va 2 s. c o m System.out.println("Instant: " + in); Date dt2 = Date.from(in); System.out.println("Date: " + dt2); }
From source file:Main.java
public static void main(String[] args) { LocalDateTime now = LocalDateTime.now(); Instant instant = now.atZone(ZoneId.systemDefault()).toInstant(); Date dateFromOld = Date.from(instant); System.out.println(dateFromOld); }
From source file:Main.java
public static Date fromLocalDateInUTC(LocalDate date) { return Date.from(date.atStartOfDay().toInstant(ZoneOffset.UTC)); }
From source file:Main.java
public static Timestamp toTimestamp(LocalDate localDate) { Date date = Date.from(localDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()); Timestamp timeStamp = new Timestamp(date.getTime()); return timeStamp; }
From source file:Main.java
public static Date fromLocalDateIn(LocalDate date, ZoneOffset timeZone) { return Date.from(date.atStartOfDay().toInstant(timeZone)); }
From source file:Main.java
public static Date roundTo30Minutes(final Date from) { long t = from.getTime(); t = t - (t % (1000 * 60 * 30));//from ww w .j a va2s . c o m t += (1000 * 60 * 30); return Date.from(Instant.ofEpochMilli(t)); }
From source file:Main.java
public static Date fromLocalDate(LocalDate date) { Instant instant = date.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant(); return Date.from(instant); }
From source file:com.rcs.shoe.shop.fx.utils.DateUtils.java
public static Date convert(LocalDate localDate) { Instant instant = Instant.from(localDate.atStartOfDay(ZoneId.systemDefault())); return Date.from(instant); }