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 boolean isToday(long dateUtc) { final long currentTime = System.currentTimeMillis(); final Calendar calendarBefore = Calendar.getInstance(); calendarBefore.setTimeInMillis(currentTime); calendarBefore.set(Calendar.HOUR_OF_DAY, 0); calendarBefore.set(Calendar.MINUTE, 0); calendarBefore.set(Calendar.SECOND, 0); calendarBefore.set(Calendar.MILLISECOND, 0); ///* www . j a v a2s.c o m*/ final Calendar calendarAfter = Calendar.getInstance(); calendarAfter.setTimeInMillis(currentTime); calendarAfter.set(Calendar.HOUR_OF_DAY, 23); calendarAfter.set(Calendar.MINUTE, 59); calendarAfter.set(Calendar.SECOND, 59); calendarAfter.set(Calendar.MILLISECOND, 250); if ((dateUtc >= calendarBefore.getTimeInMillis()) && (dateUtc <= calendarAfter.getTimeInMillis())) { return true; } return false; }
From source file:Main.java
public String currentTime() { cal.add(Calendar.MINUTE, minutesToAdd++); return sdf.format(cal.getTime()); }
From source file:edu.zipcloud.core.util.DateUtil.java
public static Date getStartOfDay(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/*from www. ja va2s .c o m*/ calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); }
From source file:Main.java
private static void setTime(Calendar date, String time) { try {//from ww w . ja v a2 s . co m String[] arr = time.split(":"); int hours = Integer.parseInt(arr[0]); int mins = Integer.parseInt(arr[1]); date.set(Calendar.HOUR_OF_DAY, hours); date.set(Calendar.MINUTE, mins); } catch (Exception e) { Log.e("Utils.java setTime", "The supplied times are not properly formatted. Verify that your schedule times follow the hh:mm pattern"); } }
From source file:com.liusoft.dlog4j.util.DateUtils.java
/** * ?// w w w.j a v a2 s .c om * @param date * @param time * @return */ public static Calendar mergeDateTime(Date date, Time time) { Calendar cal = Calendar.getInstance(); if (date != null) cal.setTime(date); if (time != null) { Calendar temp = Calendar.getInstance(); temp.setTime(time); cal.set(Calendar.HOUR_OF_DAY, temp.get(Calendar.HOUR_OF_DAY)); cal.set(Calendar.MINUTE, temp.get(Calendar.MINUTE)); cal.set(Calendar.SECOND, temp.get(Calendar.SECOND)); cal.set(Calendar.MILLISECOND, temp.get(Calendar.MILLISECOND)); } return cal; }
From source file:DateHelper.java
/** * Calculating age from a current date/*from w ww . j av a 2 s . c om*/ * * @param current * @param birthdate * @return Age from the current (arg) date */ public static float getAge(final Date current, final Date birthdate) { if (birthdate == null) { return 0; } if (current == null) { return getAge(birthdate); } else { final Calendar calend = new GregorianCalendar(); calend.set(Calendar.HOUR_OF_DAY, 0); calend.set(Calendar.MINUTE, 0); calend.set(Calendar.SECOND, 0); calend.set(Calendar.MILLISECOND, 0); calend.setTimeInMillis(current.getTime() - birthdate.getTime()); float result = 0; result = calend.get(Calendar.YEAR) - 1970; result += (float) calend.get(Calendar.MONTH) / (float) 12; return result; } }
From source file:Main.java
public static void clearCalendarMinuteWithRear(Calendar cal) { cal.set(Calendar.MINUTE, cal.getActualMinimum(Calendar.MINUTE)); clearCalendarSecondWithRear(cal);/*from w w w.j av a2 s . co m*/ }
From source file:com.ekom.ekomerp.global.DateTimeUtils.java
public static Calendar getCalendarWithoutTime(Date date, Locale locale) { Calendar calendar = Calendar.getInstance(locale); calendar.setTime(date);// w w w . ja v a 2 s . c om calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar; }
From source file:com.wiiyaya.framework.common.utils.DateUtils.java
/** * ?23:59:59/*from ww w. j av a2 s.c o m*/ * @param date * @return ?? */ public static Date setDayEnd(final Date date) { final Calendar c = Calendar.getInstance(); c.setLenient(false); c.setTime(date); c.set(Calendar.HOUR_OF_DAY, 23); c.set(Calendar.MINUTE, 59); c.set(Calendar.SECOND, 59); return c.getTime(); }
From source file:com.milos.neo4j.tasks.LockGameTask.java
@Scheduled(fixedDelayString = "5000") public void lockUnlockedGames() { Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); calendar.add(Calendar.MINUTE, -1); gameService.lockStartedGames(calendar.getTime()); }