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:com.bstek.dorado.core.el.ExpressionUtilsObject.java

public java.util.Date getToday() {
    Calendar calendar = Calendar.getInstance();
    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:es.tekniker.framework.ktek.util.Utils.java

public static long getTimeinMillis4TimeGMT(int hours, int minutes, int seconds) {
    Calendar c = getCalendarGMT();
    System.out.println("current: " + c.getTime());

    c.set(Calendar.HOUR_OF_DAY, hours);
    c.set(Calendar.MINUTE, minutes);
    c.set(Calendar.SECOND, seconds);

    System.out.println("GMT Time: " + c.getTime());

    long timeinmillis = c.getTimeInMillis();
    System.out.println(" system time in millis " + timeinmillis);

    return timeinmillis;
}

From source file:net.kamhon.ieagle.util.DateUtil.java

/**
 * add time to date./*from w ww.  j a v a 2  s . c om*/
 * 
 * @param date
 * @param time
 * @return
 */
public static Date addTime(Date date, Time time) {
    Calendar calendar = setTime(date);
    calendar.add(Calendar.SECOND, time.getSecond());
    calendar.add(Calendar.MINUTE, time.getMinute());
    calendar.add(Calendar.HOUR_OF_DAY, time.getHour());
    return calendar.getTime();
}

From source file:AIR.Common.Utilities.Dates.java

/**
 * @param date/*from   ww  w.  j a  va  2 s  .  com*/
 * @return returns the midnight time for before date ends e.g. if date is
 *         "10/11/2012 12:10 pm" then this will return "10/11/2012 11:59 pm"
 */
public static Date getEndOfDayDate(Date date) {
    Calendar calendarInstance = Calendar.getInstance();
    calendarInstance.setTime(date);
    calendarInstance.set(Calendar.HOUR_OF_DAY, 23);
    calendarInstance.set(Calendar.MINUTE, 59);
    calendarInstance.set(Calendar.SECOND, 0);
    return calendarInstance.getTime();
}

From source file:net.groupbuy.controller.admin.SalesRankingController.java

/**
 * /*from w  w  w  .  j  a va  2  s . co  m*/
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public String list(Date beginDate, Date endDate, Integer count, Model model) {
    if (beginDate != null) {
        Calendar calendar = DateUtils.toCalendar(beginDate);
        calendar.set(Calendar.HOUR_OF_DAY, calendar.getActualMinimum(Calendar.HOUR_OF_DAY));
        calendar.set(Calendar.MINUTE, calendar.getActualMinimum(Calendar.MINUTE));
        calendar.set(Calendar.SECOND, calendar.getActualMinimum(Calendar.SECOND));
        beginDate = calendar.getTime();
    }
    if (endDate != null) {
        Calendar calendar = DateUtils.toCalendar(endDate);
        calendar.set(Calendar.HOUR_OF_DAY, calendar.getActualMaximum(Calendar.HOUR_OF_DAY));
        calendar.set(Calendar.MINUTE, calendar.getActualMaximum(Calendar.MINUTE));
        calendar.set(Calendar.SECOND, calendar.getActualMaximum(Calendar.SECOND));
        endDate = calendar.getTime();
    }
    if (count == null || count <= 0) {
        count = DEFAULT_COUNT;
    }
    model.addAttribute("beginDate", beginDate);
    model.addAttribute("endDate", endDate);
    model.addAttribute("count", count);
    model.addAttribute("data", productService.findSalesList(beginDate, endDate, count));
    return "/admin/sales_ranking/list";
}

From source file:net.groupbuy.controller.admin.PurchaseRankingController.java

/**
 * /*from w w w .  j a  v  a  2  s . co  m*/
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public String list(Date beginDate, Date endDate, Integer count, Model model) {
    if (beginDate != null) {
        Calendar calendar = DateUtils.toCalendar(beginDate);
        calendar.set(Calendar.HOUR_OF_DAY, calendar.getActualMinimum(Calendar.HOUR_OF_DAY));
        calendar.set(Calendar.MINUTE, calendar.getActualMinimum(Calendar.MINUTE));
        calendar.set(Calendar.SECOND, calendar.getActualMinimum(Calendar.SECOND));
        beginDate = calendar.getTime();
    }
    if (endDate != null) {
        Calendar calendar = DateUtils.toCalendar(endDate);
        calendar.set(Calendar.HOUR_OF_DAY, calendar.getActualMaximum(Calendar.HOUR_OF_DAY));
        calendar.set(Calendar.MINUTE, calendar.getActualMaximum(Calendar.MINUTE));
        calendar.set(Calendar.SECOND, calendar.getActualMaximum(Calendar.SECOND));
        endDate = calendar.getTime();
    }
    if (count == null || count <= 0) {
        count = DEFAULT_COUNT;
    }
    model.addAttribute("beginDate", beginDate);
    model.addAttribute("endDate", endDate);
    model.addAttribute("count", count);
    model.addAttribute("data", memberService.findPurchaseList(beginDate, endDate, count));
    return "/admin/purchase_ranking/list";
}

From source file:com.esofthead.mycollab.core.utils.DateTimeUtils.java

public static Date getCurrentDateWithoutMS() {
    GregorianCalendar calendar = new GregorianCalendar();
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MINUTE, 0);
    return calendar.getTime();
}

From source file:com.aw.core.db.DbUtil.java

public boolean hasOnlyDateInfo(Date date) {
    Calendar cal = new GregorianCalendar();
    cal.setTime(date);/*from   w w  w .  j av a  2 s  . c  om*/
    if (cal.get(Calendar.HOUR_OF_DAY) != 0)
        return false;
    if (cal.get(Calendar.MINUTE) != 0)
        return false;
    if (cal.get(Calendar.SECOND) != 0)
        return false;
    if (cal.get(Calendar.MILLISECOND) != 0)
        return false;
    return true;
}

From source file:com.mediaportal.ampdroid.api.JsonUtils.java

public static BasicNameValuePair newPair(String _name, Date _value) {
    Calendar cal = Calendar.getInstance();
    cal.setTime(_value);/*www.j ava 2s .  c  om*/
    int offset = (int) ((cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET)) / 60000);

    cal.add(Calendar.MINUTE, offset);
    String dateString = IsoDate.dateToString(cal.getTime(), IsoDate.DATE_TIME);

    return new BasicNameValuePair(_name, dateString);
}

From source file:plbtw.klmpk.barang.hilang.service.impl.LogServiceImpl.java

@Override
public Long rateLimit(String apiKey) {
    Calendar dateNowCalendar = Calendar.getInstance();
    Date dateNow = dateNowCalendar.getTime();
    Calendar dateLastOneMinute = Calendar.getInstance();
    dateLastOneMinute.add(Calendar.MINUTE, -1);
    Date dateBefore = dateLastOneMinute.getTime();
    return logRepository.countByApiKeyAndTimeRequestBetween(apiKey, dateBefore, dateNow);
}