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 int getMinutes() {
    Calendar c = Calendar.getInstance();
    c.setTime(new Date());
    int minute = c.get(Calendar.MINUTE);
    return minute;
}

From source file:Main.java

public static Calendar newInitializedCalendar() {
    Calendar newitem = Calendar.getInstance();
    newitem.set(Calendar.HOUR, 0);
    newitem.set(Calendar.MINUTE, newitem.getMinimum(Calendar.MINUTE));
    newitem.set(Calendar.SECOND, newitem.getMinimum(Calendar.SECOND));
    newitem.set(Calendar.MILLISECOND, newitem.getMinimum(Calendar.MILLISECOND));
    return newitem;
}

From source file:Main.java

public static Date addFiveMinutes(Date date) {

    Calendar cal = Calendar.getInstance();
    cal.setTime(date);/*from   w w w  .  ja v a2s  . com*/
    cal.add(Calendar.MINUTE, 5);
    return cal.getTime();
}

From source file:Main.java

public static Calendar getDate(Calendar calendar) {
    Calendar cal = (Calendar) calendar.clone();
    cal.set(Calendar.HOUR_OF_DAY, 0);
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);/*from w w  w . j a  v  a 2s .  c  o m*/
    cal.set(Calendar.MILLISECOND, 0);
    return cal;
}

From source file:Main.java

public static Calendar clearTime(Calendar calendar) {
    calendar.clear(Calendar.HOUR_OF_DAY);
    calendar.clear(Calendar.HOUR);
    calendar.clear(Calendar.MINUTE);
    calendar.clear(Calendar.SECOND);
    calendar.clear(Calendar.MILLISECOND);

    return calendar;
}

From source file:Main.java

public static int getCurrentTimeStamp() {
    Calendar now = Calendar.getInstance();
    int hour = now.get(Calendar.HOUR_OF_DAY);
    int minute = now.get(Calendar.MINUTE);
    return 60 * hour + minute;
}

From source file:Main.java

public static long getTimeMillisAt(int hour, int minute) {
    Calendar today = Calendar.getInstance();
    today.set(Calendar.HOUR_OF_DAY, hour);
    today.set(Calendar.MINUTE, minute);
    return today.getTimeInMillis();
}

From source file:Main.java

public static Calendar clearToDate(Calendar calendar) {
    return clear(calendar, Calendar.HOUR, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND,
            Calendar.MILLISECOND);
}

From source file:Main.java

private static Calendar getTodayAutoPushTime() {
    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.HOUR_OF_DAY, 10);
    calendar.set(Calendar.MINUTE, 0);

    return calendar;
}

From source file:Main.java

public static String getStringTime() {
    Calendar c = Calendar.getInstance(Locale.ITALY);
    return c.get(Calendar.HOUR_OF_DAY) + ":" + c.get(Calendar.MINUTE) + ":" + c.get(Calendar.SECOND);
}