Example usage for java.util Calendar MINUTE

List of usage examples for java.util Calendar MINUTE

Introduction

In this page you can find the example usage for java.util Calendar MINUTE.

Prototype

int MINUTE

To view the source code for java.util Calendar MINUTE.

Click Source Link

Document

Field number for get and set indicating the minute within the hour.

Usage

From source file:Main.java

public static boolean isSameTime(Calendar startTime, Calendar endTime) {
    if (startTime.get(Calendar.HOUR) == endTime.get(Calendar.HOUR)
            && startTime.get(Calendar.MINUTE) == endTime.get(Calendar.MINUTE))
        return true;
    else//from  ww  w .j a  v  a 2s.  c  o  m
        return false;
}

From source file:Main.java

static public Calendar getTimeFromInt(int hourOfDay, int minute) {
    Calendar c = Calendar.getInstance();

    c.set(Calendar.HOUR_OF_DAY, hourOfDay);
    c.set(Calendar.MINUTE, minute);

    return c;//  w w  w. j  a  v a2s  .c  o m
}

From source file:Main.java

public static Calendar getCurrentDateWithoutTime() {
    Calendar cal = Calendar.getInstance(); // locale-specific
    cal.set(Calendar.HOUR_OF_DAY, 0);
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);// ww  w  .  ja v a2s .c o  m
    cal.set(Calendar.MILLISECOND, 0);
    return cal;
}

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);//from   w  w w . j a v  a2 s .  co  m
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.MILLISECOND, 0);
    return cal.getTimeInMillis();
}

From source file:Main.java

private static Date get8Hours10MinsAgo() {
    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.HOUR, -8);
    calendar.add(Calendar.MINUTE, -10);

    return calendar.getTime();
}

From source file:Main.java

public static Calendar today() {
    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, 0);
    return date;/*  w  ww  .  ja  v  a  2s  . co  m*/
}

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);//from   ww w .  j av a  2 s . c  om
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.MILLISECOND, 0);
    return cal.getTimeInMillis();
}

From source file:Main.java

public static void clearTimeInfo(Calendar theDate) {
    if (theDate == null) {
        return;/*  ww  w .  j a va 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

private static long getTodayZeroTime() {
    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.HOUR_OF_DAY, 0);
    cal.set(Calendar.SECOND, 0);/*from   w  w  w  .  ja  v  a2  s.  c o m*/
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.MILLISECOND, 0);
    return cal.getTimeInMillis();
}