List of usage examples for java.util Calendar getTimeInMillis
public long getTimeInMillis()
From source file:Main.java
public static long toMillis(Calendar calendar) { return calendar.getTimeInMillis(); }
From source file:Main.java
public static int minutesBetweenDates(Calendar from, Calendar to) { long ms = to.getTimeInMillis() - from.getTimeInMillis(); int minutes = (int) (ms / 60000); return minutes; }
From source file:Main.java
public static int calculateDays(Calendar start, Calendar end) { long diff = end.getTimeInMillis() - start.getTimeInMillis(); float dayCount = ((float) diff / (24 * 60 * 60 * 1000)); return (int) (dayCount + .5); }
From source file:Main.java
/** * returns the date in millisecond//from w ww . ja va 2 s. c om * * @return */ public static long getTimeInMilliseconds(Calendar currentDate) { return currentDate.getTimeInMillis(); }
From source file:Main.java
public static void waitUntil(Calendar time) { waitUntil(time.getTimeInMillis()); }
From source file:Main.java
public static Calendar min(Calendar c1, Calendar c2) { if (c1.getTimeInMillis() <= c2.getTimeInMillis()) { return c1; } else {// www .ja v a 2 s . com return c2; } }
From source file:Main.java
/** * Get the number of days between calendars * @param cIni Calendar initial/*w ww . ja v a2 s . co m*/ * @param cEnd Calendar end * @return int num of days */ public static int getNumDays(Calendar cIni, Calendar cEnd) { long difMillis = cEnd.getTimeInMillis() - cIni.getTimeInMillis(); return (int) (difMillis / 86400000); }
From source file:Main.java
public static boolean isExpired(long expiration) { Calendar c = Calendar.getInstance(); return c.getTimeInMillis() >= expiration; }
From source file:Main.java
public static int dayFrom_CalendarLocal(Calendar c) { return dayFrom_Milliseconds(c.getTimeInMillis() + c.get(Calendar.ZONE_OFFSET)); }
From source file:Main.java
public static long getCurrentTimeInMillisecs() { Calendar cal = Calendar.getInstance(); return cal.getTimeInMillis(); }