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 long firstOfTheMonth9am() { Calendar c = Calendar.getInstance(); c.set(Calendar.DAY_OF_MONTH, 1); c.set(Calendar.HOUR_OF_DAY, 9); c.set(Calendar.MINUTE, 0);/* ww w . j a v a2 s .co m*/ c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); return c.getTimeInMillis(); }
From source file:Main.java
public static void clearTimeInfo(Calendar theDate) { if (theDate == null) { return;/*from ww w. j av a 2 s . c o m*/ } theDate.set(Calendar.HOUR_OF_DAY, 0); theDate.set(Calendar.MINUTE, 0); theDate.set(Calendar.SECOND, 0); }
From source file:Main.java
public static long getTodayStartTime() { Calendar date = new GregorianCalendar(); date.set(Calendar.HOUR_OF_DAY, 0); date.set(Calendar.MINUTE, 0); date.set(Calendar.SECOND, 0); date.set(Calendar.MILLISECOND, 1); return date.getTimeInMillis(); }
From source file:Main.java
public static Calendar GetTodayLeftRange(Calendar today) { Calendar calendar = (Calendar) today.clone(); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.add(Calendar.MINUTE, 0); return calendar; }
From source file:Main.java
public static long getTodayMills() { Calendar c = Calendar.getInstance(); c.setTimeInMillis(System.currentTimeMillis()); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0);/*from w w w . j a va 2 s . c o m*/ c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); return c.getTimeInMillis(); }
From source file:Main.java
public static long getTimeInitializeMills(long mills) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(mills);// w w w . j a va 2 s . c o m c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); return c.getTimeInMillis(); }
From source file:Main.java
public static long date2long(int hour, int minute, int second) { Calendar c = Calendar.getInstance(); c.set(Calendar.HOUR_OF_DAY, 18); c.set(Calendar.MINUTE, 0);/* www . ja v a2 s . co m*/ c.set(Calendar.SECOND, 0); Date d = c.getTime(); return d.getTime(); }
From source file:Main.java
public static long startOfTodDay() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); Date date = calendar.getTime(); return date.getTime(); }
From source file:Main.java
public static long setTimeToMidnightAndGet(Calendar cal, long epoch) { cal.setTime(new Date(epoch)); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0);//from w ww . j a va 2 s . c o m cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }
From source file:Main.java
public static Calendar GetTodayRightRange(Calendar today) { Calendar calendar = (Calendar) today.clone(); calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.add(Calendar.MINUTE, 0); return calendar; }