List of usage examples for java.util Calendar SECOND
int SECOND
To view the source code for java.util Calendar SECOND.
Click Source Link
get
and set
indicating the second within the minute. From source file:Main.java
public static Calendar getTimeAfterInSecs(int secs) { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.SECOND, secs); return calendar; }
From source file:Main.java
private static long delayToNextMinute() { Date now = new Date(); long sec = Calendar.getInstance().get(Calendar.SECOND); return now.getTime() - sec * 1000 + 61 * 1000; }
From source file:Main.java
public static long getDayStart() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MINUTE, 0);/*from w ww . ja va 2 s. co m*/ cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }
From source file:Main.java
public static long getTimesEnd() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.MILLISECOND, 999); return cal.getTimeInMillis(); }
From source file:Main.java
public static long getTimesStart() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MINUTE, 0);//from w w w . java 2 s . c o m cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }
From source file:Main.java
private static long getTodayZeroTime() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MINUTE, 0);/* w w w . j a v a 2 s . c o m*/ cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }
From source file:Main.java
public static long getTimesNextStart() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 24); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MINUTE, 0);//from www. j ava2 s.c o m cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }
From source file:Main.java
public static Calendar toBeginningOfDay(Calendar day) { day.set(Calendar.HOUR_OF_DAY, 0); day.set(Calendar.MINUTE, 0);/*from ww w . j a v a 2 s.c o m*/ day.set(Calendar.SECOND, 0); day.set(Calendar.MILLISECOND, 0); return day; }
From source file:Main.java
private static void removeTimeFromCalendar(Calendar cal) { cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0);/*from w ww . j a va 2 s . co m*/ cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); }
From source file:Main.java
private static long getYesterdayZeroTime() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, -24); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MINUTE, 0);/* ww w . j a v a 2 s . c om*/ cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }