List of usage examples for java.util Date getTime
public long getTime()
From source file:Main.java
public static String saveDate(Date d) { return "@" + d.getTime(); }
From source file:Main.java
public static int daysBetween(Date d1, Date d2) { return (int) ((d2.getTime() - d1.getTime()) / (1000 * 60 * 60 * 24)); }
From source file:Main.java
public static LocalDate getLocalDateFromDate(Date date) { return LocalDateTime.ofInstant(new Date(date.getTime()).toInstant(), ZoneId.systemDefault()).toLocalDate(); }
From source file:Main.java
public static long getDiffInHours(Date startDate, Date endDate) { long diff = endDate.getTime() - startDate.getTime(); return diff / 1000 / 60 / 60; }
From source file:Main.java
public static long diffMinutes(Date one, Date two) { return (one.getTime() - two.getTime()) / (60 * 1000); }
From source file:Main.java
public static boolean isAB(Date A, Date B) { long a = A.getTime(); long b = B.getTime(); return a >= b; }
From source file:Main.java
/** * Generates a string SQL expression to convert java date to sqlite unix style *//*from w ww. j a v a 2 s . c o m*/ public static String javaDate2sqlite(Date javaDate) { return "" + (javaDate.getTime() / 1000L); }
From source file:Main.java
public static void putDate(Bundle bundle, String key, Date date) { bundle.putLong(key, date.getTime()); }
From source file:Main.java
/** * elapsedMinuted//from w w w . jav a2s .c o m * Get the elapsed minutes between two dates * * @param dateStart the date start * @param dateEnd the date end * @return the elapsed hours and minutes in a long */ public static long elapsedMilliseconds(Date dateStart, Date dateEnd) { return dateEnd.getTime() - dateStart.getTime(); }
From source file:Main.java
public static boolean epsilonBefore(Date d1, Date d2) { final long diff = d2.getTime() - d1.getTime(); return diff > MILLIS_EPSILON; }