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 long getTimeInitializeMills(long mills) {
    Calendar c = Calendar.getInstance();
    c.setTimeInMillis(mills);//from  w ww.j a v a  2  s  . co 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);
    c.set(Calendar.SECOND, 0);/* w  ww  . ja v  a  2s . c o  m*/
    Date d = c.getTime();
    return d.getTime();
}

From source file:Main.java

public static Calendar GetYesterdayRightRange(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.DAY_OF_MONTH, -1);
    calendar.add(Calendar.MINUTE, 0);
    return calendar;
}

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);
    cal.set(Calendar.SECOND, 0);/*  ww w.j a  v a 2s.  c  o m*/
    cal.set(Calendar.MILLISECOND, 0);
    return cal.getTimeInMillis();
}

From source file:Main.java

public static Calendar getCalendarAtMidnight(int relativeDayToToday) {
    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    calendar.add(Calendar.DAY_OF_YEAR, relativeDayToToday);
    return calendar;
}

From source file:Main.java

public static Calendar getEndOfDate(long time) {
    Calendar ret = Calendar.getInstance();
    ret.setTimeInMillis(time);/*from w w  w.j a v  a 2s .c  o  m*/
    ret.set(Calendar.HOUR_OF_DAY, 23);
    ret.set(Calendar.MINUTE, 59);
    ret.set(Calendar.SECOND, 59);
    ret.set(Calendar.MILLISECOND, 999);

    return ret;
}

From source file:Main.java

public static Date round2Hour(Date date) {
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);/*from w w w .ja v a 2s. c om*/
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 0);
    return cal.getTime();
}

From source file:Main.java

public static Calendar getBeginOfDate(long time) {
    Calendar ret = Calendar.getInstance();
    ret.setTimeInMillis(time);//from w ww .  ja v  a2  s  .  com
    ret.set(Calendar.HOUR_OF_DAY, 0);
    ret.set(Calendar.MINUTE, 0);
    ret.set(Calendar.SECOND, 0);
    ret.set(Calendar.MILLISECOND, 0);

    return ret;
}

From source file:Main.java

public static Calendar tomorrow() {
    Calendar tomorrow = new GregorianCalendar();
    tomorrow.set(Calendar.HOUR_OF_DAY, 0);
    tomorrow.set(Calendar.MINUTE, 0);
    tomorrow.set(Calendar.SECOND, 0);
    tomorrow.set(Calendar.MILLISECOND, 0);
    tomorrow.add(Calendar.DAY_OF_MONTH, 1);
    return tomorrow;
}

From source file:Main.java

static private Calendar getCalendarAlarmTime(int hour, int minute) {
    Calendar alarmTime = Calendar.getInstance();

    alarmTime.set(Calendar.HOUR_OF_DAY, hour);
    alarmTime.set(Calendar.MINUTE, minute);
    alarmTime.set(Calendar.SECOND, 0);

    return alarmTime;

}