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:Util.java

private static boolean isMidnight(Calendar calendar) {
    return (calendar.get(Calendar.HOUR_OF_DAY) == 0) && (calendar.get(Calendar.MINUTE) == 0);
}

From source file:helper.lang.DateHelperTest.java

@Test
public void testAsUtcDayCalendar() {
    Calendar localTime = Calendar.getInstance(TimeZone.getTimeZone("CST"));
    Calendar cal = DateHelper.asUtcDay(localTime);
    assertEquals(0, cal.get(Calendar.MILLISECOND));
    assertEquals(0, cal.get(Calendar.MINUTE));
    assertEquals(0, cal.get(Calendar.HOUR));
    assertEquals(0, cal.get(Calendar.HOUR_OF_DAY));
    assertEquals(DateHelper.UTC_TIME_ZONE, cal.getTimeZone());
    assertEquals(TimeZone.getTimeZone("CST"), localTime.getTimeZone());
    assertEquals(localTime.get(Calendar.YEAR), cal.get(Calendar.YEAR));
    assertEquals(localTime.get(Calendar.MONTH), cal.get(Calendar.MONTH));
    assertEquals(localTime.get(Calendar.DATE), cal.get(Calendar.DATE));
}

From source file:TimeUtil.java

public static short mowFormat(long msecs) {
    synchronized (statFmtCal) {
        statFmtCal.setTime(new Date(msecs));

        return ((short) ((statFmtCal.get(Calendar.DAY_OF_WEEK) - 1) * 1440
                + statFmtCal.get(Calendar.HOUR_OF_DAY) * 60 + statFmtCal.get(Calendar.MINUTE)));
    }/* www . j  ava 2 s  . c om*/
}

From source file:cz.cvut.kbss.wpa.service.test.PlayerServiceTest.java

@BeforeClass
public static void setUp() {
    b = Calendar.getInstance();/*w ww.  ja v  a2 s  .  co  m*/
    b.set(Calendar.YEAR, 1986);
    b.set(Calendar.MONTH, Calendar.APRIL);
    b.set(Calendar.DAY_OF_MONTH, 28);
    b.set(Calendar.HOUR, 0);
    b.set(Calendar.MINUTE, 0);
    b.set(Calendar.SECOND, 0);
}

From source file:com.westlinkin.android_feedback_helper.utils.MailUntils.java

private static String getFeedbackNumber() {
    Calendar calendar = Calendar.getInstance();
    return "" + calendar.get(Calendar.YEAR)
            + Utils.formatCalendarIntValue((calendar.get(Calendar.MONTH) + 1), 2)
            + Utils.formatCalendarIntValue(calendar.get(Calendar.DAY_OF_MONTH), 2) + "-"
            + Utils.formatCalendarIntValue(calendar.get(Calendar.HOUR_OF_DAY), 2)
            + Utils.formatCalendarIntValue(calendar.get(Calendar.MINUTE), 2)
            + Utils.formatCalendarIntValue(calendar.get(Calendar.SECOND), 2) + "-"
            + Utils.formatCalendarIntValue(calendar.get(Calendar.MILLISECOND), 3);
}

From source file:J2MEFixedRateSchedule.java

public void startApp() {
    d.addCommand(new Command("Exit", Command.EXIT, 0));
    d.setCommandListener(new CommandListener() {
        public void commandAction(Command c, Displayable s) {
            notifyDestroyed();/*  w  w w.ja va 2s  .com*/
        }
    });
    now.setTime(currentTime);

    nowString = now.get(Calendar.HOUR) + ":" + now.get(Calendar.MINUTE) + ":" + now.get(Calendar.SECOND) + ":";

    aTimer = new Timer();
    aTimerTask = new ClockTimerTask();
    aTimer.scheduleAtFixedRate(aTimerTask, 10, 1000);

    Display.getDisplay(this).setCurrent(d);
}

From source file:com.qpark.eip.core.spring.auth.LimitedAccessDataProvider.java

/**
 * Get a {@link Date}, where hours, minutes, seconds and milliseconds are
 * set to 0.//from ww  w .  ja  v a2s. c om
 *
 * @return the {@link Date} and the corresponding log string.
 */
private static SimpleEntry<Date, String> getRequestDate() {
    Calendar gc = new GregorianCalendar();
    gc.set(Calendar.HOUR_OF_DAY, 0);
    gc.set(Calendar.MINUTE, 0);
    gc.set(Calendar.SECOND, 0);
    gc.set(Calendar.MILLISECOND, 0);
    String hmss = String.format("%04d%02d%02d", gc.get(Calendar.YEAR), gc.get(Calendar.MONTH) + 1,
            gc.get(Calendar.DAY_OF_MONTH));
    SimpleEntry<Date, String> entry = new SimpleEntry<Date, String>(gc.getTime(), hmss);
    return entry;
}

From source file:com.microsoft.exchange.DateHelp.java

/**
 * Convert a {@link String} in the common date/time format for this application into a {@link Date}.
 * // w  w  w.j  a va 2  s  . c o  m
 * @param timePhrase format: "yyyyMMdd-HHmm"
 * @return the corresponding date
 * @throws IllegalArgumentException
 */
public static Date parseDateTimePhrase(final String timePhrase) {
    if (timePhrase == null) {
        return null;
    }
    try {
        Date time = getDateTimeFormat().parse(timePhrase);
        time = DateUtils.truncate(time, Calendar.MINUTE);
        return time;
    } catch (ParseException e) {
        throw new IllegalArgumentException("cannot parse date/time phrase " + timePhrase, e);
    }
}

From source file:TimeUtil.java

public static String stringSecsFormat(long msecs) {
    GregorianCalendar cal = new GregorianCalendar();
    StringBuffer sBuf = new StringBuffer(11);

    cal.setTime(new Date(msecs));

    int hour = cal.get(Calendar.HOUR);

    if (hour == 0)
        hour = 12;//w ww.j  a  v  a 2 s .  c  o m

    if (hour < 10)
        sBuf.append(" ");

    sBuf.append(Integer.toString(hour));
    sBuf.append(":");

    int minute = cal.get(Calendar.MINUTE);

    if (minute < 10)
        sBuf.append("0");

    sBuf.append(Integer.toString(minute));
    sBuf.append(":");

    int secs = cal.get(Calendar.SECOND);

    if (secs < 10) {
        sBuf.append("0");
    }
    sBuf.append(Integer.toString(secs));

    sBuf.append(" ");
    sBuf.append(cal.get(Calendar.AM_PM) == Calendar.AM ? "AM" : "PM");

    return (sBuf.toString());
}

From source file:be.boyenvaesen.Humidity.HumidityServiceyByDateTest.java

@Before
public void setUp() {

    service.deleteAll();//from w  w  w . j av a 2s  .  c o  m
    Calendar c = Calendar.getInstance();
    c.set(2016, 10, 23, 14, 00);
    for (int i = 0; i < 10; i++) {

        service.addNew(new postObject<>(50f + 5f * i, c.getTime()));
        c.add(Calendar.MINUTE, 10);
    }

}