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 String getClockTimeFromSeconds(long secs) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(secs * 1000L);/*from w ww . j a va 2 s . co m*/ return String.format("%02d:%02d", c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE)); }
From source file:Main.java
public static long getBeginOfCurrentDateInMillis() { Calendar calendar = Calendar.getInstance(); calendar.clear(Calendar.HOUR); calendar.clear(Calendar.HOUR_OF_DAY); calendar.clear(Calendar.MINUTE); calendar.clear(Calendar.SECOND); calendar.clear(Calendar.MILLISECOND); return calendar.getTimeInMillis(); }
From source file:Main.java
public static Date getEndOfDate(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);//from w w w . j a va 2s . com calendar.set(Calendar.HOUR, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); return calendar.getTime(); }
From source file:Main.java
public static Calendar getNotificationCalendarDate(int hour, int minute) { Calendar currentCalendar = Calendar.getInstance(); currentCalendar.set(Calendar.HOUR_OF_DAY, hour); currentCalendar.set(Calendar.MINUTE, minute); return currentCalendar; }
From source file:Main.java
public static Date getStartOfDate(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);//from w w w .j av a 2 s . c o m calendar.set(Calendar.HOUR, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); return calendar.getTime(); }
From source file:Main.java
public static Calendar tomorrow() { Calendar date = new GregorianCalendar(); date.add(Calendar.DATE, 1);/*ww w . j av a 2s .com*/ date.set(Calendar.HOUR_OF_DAY, 0); date.set(Calendar.MINUTE, 0); date.set(Calendar.SECOND, 0); date.set(Calendar.MILLISECOND, 0); return date; }
From source file:Main.java
public static long endOfThisMonth() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.DAY_OF_MONTH, 1); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 999); cal.add(Calendar.MONTH, 1);/*from w w w.j a va 2s . c o m*/ cal.add(Calendar.DATE, -1); Date date = cal.getTime(); return date.getTime(); }
From source file:Main.java
private static long getTimeInMillis() { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.set(Calendar.HOUR_OF_DAY, 21); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); return calendar.getTimeInMillis(); }
From source file:Main.java
public static long getTimesmorning() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.SECOND, 0);//w w w. j a v a2s .c om cal.set(Calendar.MINUTE, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }
From source file:Main.java
public static String getCurrentTime() { Calendar calendar = Calendar.getInstance(); return getToday() + " " + calendar.get(Calendar.HOUR_OF_DAY) + ":" + calendar.get(Calendar.MINUTE); }