List of usage examples for java.util Calendar MINUTE
int MINUTE
To view the source code for java.util Calendar MINUTE.
Click Source Link
get
and set
indicating the minute within the hour. From source file:Main.java
public static Calendar getNotificationCalendarNextDate(int hour, int minute) { Calendar currentCalendar = Calendar.getInstance(); currentCalendar.add(Calendar.DATE, 1); currentCalendar.set(Calendar.HOUR_OF_DAY, hour); currentCalendar.set(Calendar.MINUTE, minute); return currentCalendar; }
From source file:Main.java
public static Date getDateEnd(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);//from www .j av a 2s . c o m calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); return calendar.getTime(); }
From source file:Main.java
public static Date getDateStart(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/*from w w w.j a v a 2 s . c o m*/ calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); return calendar.getTime(); }
From source file:Main.java
public static String getTimeString(long millitm) { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); cal.setTimeInMillis(millitm);// w w w. j a v a 2 s. c o m return (setZeroPad(cal.get(Calendar.HOUR)) + ":" + setZeroPad(cal.get(Calendar.MINUTE)) + ":" + setZeroPad(cal.get(Calendar.SECOND))); }
From source file:Main.java
public static Date moveToToday(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date);/*from w w w .j a va 2 s . com*/ int hour = cal.get(Calendar.HOUR_OF_DAY); int minute = cal.get(Calendar.MINUTE); Calendar result = Calendar.getInstance(); result.set(Calendar.HOUR_OF_DAY, hour); result.set(Calendar.MINUTE, minute); return result.getTime(); }
From source file:Main.java
public static Long getToday() { Calendar today = Calendar.getInstance(); today.setTimeZone(TimeZone.getDefault()); today.set(Calendar.SECOND, 0); today.set(Calendar.MINUTE, 0); today.set(Calendar.HOUR_OF_DAY, 1); today.set(Calendar.MILLISECOND, 0); // FOR DEBUG// w w w . j av a 2s .c o m //today.set(Calendar.DAY_OF_YEAR, today.get(Calendar.DAY_OF_YEAR) + 1); return today.getTimeInMillis(); }
From source file:Main.java
public static int getGapDay(Date startDate, Date endDate) { Calendar fromCalendar = Calendar.getInstance(); fromCalendar.setTime(startDate);//ww w. ja v a 2 s.c om fromCalendar.set(Calendar.HOUR_OF_DAY, 0); fromCalendar.set(Calendar.MINUTE, 0); fromCalendar.set(Calendar.SECOND, 0); fromCalendar.set(Calendar.MILLISECOND, 0); Calendar toCalendar = Calendar.getInstance(); toCalendar.setTime(endDate); toCalendar.set(Calendar.HOUR_OF_DAY, 0); toCalendar.set(Calendar.MINUTE, 0); toCalendar.set(Calendar.SECOND, 0); toCalendar.set(Calendar.MILLISECOND, 0); return (int) ((toCalendar.getTime().getTime() - fromCalendar.getTime().getTime()) / (1000 * 60 * 60 * 24)); }
From source file:Main.java
/** * @return Return current day timestamp with YY, MM, dd info ONLY *//*from w w w . j a v a 2 s .c o m*/ public static Long getCurrentDayTS() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }
From source file:Main.java
public static long getTimeLongTenHours(int year, int month, int day) { Calendar calendar = Calendar.getInstance(); calendar.set(year, month, day);// ww w . ja v a 2s. c o m calendar.set(Calendar.HOUR_OF_DAY, 10); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTimeInMillis(); }
From source file:Main.java
static Calendar toNearestWholeMinute(Calendar d) { Calendar c = new GregorianCalendar(); c.setTime(d.getTime());/* www. j av a 2s .c o m*/ if (c.get(Calendar.SECOND) >= 30) c.add(Calendar.MINUTE, 1); c.set(Calendar.SECOND, 0); return c; }