Example usage for java.util Date getMinutes

List of usage examples for java.util Date getMinutes

Introduction

In this page you can find the example usage for java.util Date getMinutes.

Prototype

@Deprecated
public int getMinutes() 

Source Link

Document

Returns the number of minutes past the hour represented by this date, as interpreted in the local time zone.

Usage

From source file:com.b5m.user.frame.util.DateUtils.java

/**
 *  ?  /*from ww  w. j  a  v a  2s.  com*/
 * @return int
 */
public static int remainSecondsInToday() {
    int remainSeconds = DAY_SECONDS;
    Date date = new Date();
    int currentTimeSendcods = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds();
    remainSeconds = DAY_SECONDS - currentTimeSendcods;
    return remainSeconds;
}

From source file:Main.java

public static int milli2int(long milli) {
    Date date = new Date(milli);
    int total = 0;
    int year = date.getYear() - 112;
    int month = date.getMonth() + 1;
    int day = date.getDate();
    int hour = date.getHours();
    int minute = date.getMinutes();
    int sec = date.getSeconds();
    total = year << 26;/*from  w w w.j a v a 2s. co  m*/
    total |= month << 22;
    total |= day << 17;
    total |= hour << 12;
    total |= minute << 6;
    total |= sec;
    return total;
}

From source file:Main.java

/**
 * Gets the default ARO trace folder name in the HH:MM:SS:DD:MM:YY format.
 * /*from   w  ww.ja  va2s  .  c  om*/
 * @return The default ARO trace folder name.
 */
public static String getDefaultTraceFolderName() {
    final Date systemDate = new Date();
    final Calendar now = Calendar.getInstance();
    final int currenthours = systemDate.getHours();
    final int currentminutes = systemDate.getMinutes();
    final int currentseconds = systemDate.getSeconds();
    final int currentdate = now.get(Calendar.DATE); // java calendar

    int currentmonth = now.get(Calendar.MONTH); // As Jan is defined as 0 in
    currentmonth = currentmonth + 1;
    if (currentmonth >= 13) // As Jan is defined as 0 in java calendar
        currentmonth = 1;
    String currentMonth = Integer.toString(currentmonth);
    String currentDate = Integer.toString(currentdate);
    String currentHours = Integer.toString(currenthours);
    String currentMinutes = Integer.toString(currentminutes);
    String currentSeconds = Integer.toString(currentseconds - 1);

    if (currentmonth < 10) {
        currentMonth = "";
        currentMonth = "0" + currentmonth;
    }
    if (currentdate < 10) {
        currentDate = "";
        currentDate = "0" + currentdate;
    }

    if (currenthours < 10) {
        currentHours = "";
        currentHours = "0" + currenthours;
    }
    if (currentminutes < 10) {
        currentMinutes = "";
        currentMinutes = "0" + currentminutes;
    }
    if (currentseconds < 10) {
        currentSeconds = "";
        currentSeconds = "0" + currentseconds;
    }
    final String folderName = now.get(Calendar.YEAR) + "-" + currentMonth + "-" + currentDate + "-"
            + currentHours + "-" + currentMinutes + "-" + currentSeconds;

    return folderName;
}

From source file:ch.ethz.inf.vs.android.g54.a4.util.SnapshotCache.java

private static String constructFileName(String name) {
    Date d = new Date();
    return String.format("%d-%d-%d_%d-%d-%d_%s.%s", d.getYear() + 1900, d.getMonth(), d.getDay(), d.getHours(),
            d.getMinutes(), d.getSeconds(), name, FILE_EXTENSION);
}

From source file:net.duckling.ddl.web.api.APITeamUpdatesController.java

@SuppressWarnings("deprecation")
private static AoneNoticeParam getMobileTeamNoticeQueryParam(int tid, String date, int offset) {
    AoneNoticeParam p = new AoneNoticeParam(tid, NoticeRule.TEAM_NOTICE, tid + "");
    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    Date begin = null;//from   w ww .ja va 2 s  .  c o  m
    try {
        if (date != null) {
            begin = dateFormat.parse(date);
            if (offset > 0) {
                // ??
                Date now = new Date();
                int hour = now.getHours();
                int minute = now.getMinutes();
                long time = begin.getTime() + hour * 60 * 60 * 1000 + minute * 60 * 1000;
                begin = new Date(time);
            }
        } else {
            begin = new Date();
        }
    } catch (ParseException e) {
        begin = new Date();
    }
    p.setBeginDate(DateUtils.addDays(begin, DEFAULT_MOBILE_DURATION));
    p.setEndDate(begin);
    return p;
}

From source file:com.fluidops.iwb.api.valueresolver.ValueResolverUtil.java

/**
  * Converts a system date like '2011-03-31T19:54:33' to user-readable date.
  * If the input is not a valid system date, the value is returned as is.
  * /*from  w  ww .j  a  va  2s  . c  o m*/
  * @param sysdate
  * @return
  */
@SuppressWarnings("deprecation")
public static String resolveSystemDate(String sysdate) {

    Date d = ReadDataManagerImpl.ISOliteralToDate(sysdate);
    if (d == null)
        return StringEscapeUtils.escapeHtml(sysdate);

    DateFormat df = null;
    if (d.getHours() == 0 && d.getMinutes() == 0 && d.getSeconds() == 0)
        df = new SimpleDateFormat("MMMMM dd, yyyy");
    else
        df = new SimpleDateFormat("MMMMM dd, yyyy, HH:mm:ss");
    return df.format(d);

}

From source file:gov.nih.nci.cabig.caaers.utils.DateUtils.java

public static String formatDate(Date d) {
    if (d.getHours() > 0 || d.getMinutes() > 0)
        return formatDate(d, DATE_WITH_DATETIME);
    return formatDate(d, DATE_PATTERN);
}

From source file:DateUtil.java

/**
 * Tells you if the date part of a datetime is in a certain time range.
 *///  w  w  w  . j a  v  a 2 s.  c  o m
public static boolean isTimeInRange(java.sql.Time start, java.sql.Time end, java.util.Date d) {
    d = new java.sql.Time(d.getHours(), d.getMinutes(), d.getSeconds());

    if (start == null || end == null) {
        return false;
    }

    if (start.before(end) && (!(d.after(start) && d.before(end)))) {
        return false;
    }

    if (end.before(start) && (!(d.after(end) || d.before(start)))) {
        return false;
    }
    return true;
}

From source file:DateUtil.java

/**
 * Checks the hour, minute and second are equal.
 *//*w w w . ja  v a 2 s . com*/
public static boolean timeEquals(java.util.Date d1, java.util.Date d2) {
    if (d1 == null || d2 == null)
        return false;

    return d1.getHours() == d2.getHours() && d1.getMinutes() == d2.getMinutes()
            && d1.getSeconds() == d2.getSeconds();
}

From source file:playground.jbischoff.taxi.berlin.supply.TaxiStatusDataAnalyser.java

private static void writeIdleVehiclesByZoneAndStatus(Matrices statusMatrices, String idleVehicles, String start,
        String end) throws ParseException, IOException {

    Set<String> allZones = new HashSet<String>();
    for (Matrix matrix : statusMatrices.getMatrices().values()) {
        allZones.addAll(matrix.getFromLocations().keySet());
    }//w w w . ja  v  a  2s.com

    BufferedWriter writer = IOUtils.getBufferedWriter(idleVehicles);
    Date currentTime = STATUS_DATE_FORMAT.parse(start);
    Date endTime = STATUS_DATE_FORMAT.parse(end);

    //header
    writer.append("zone");
    while (!currentTime.equals(endTime)) {

        if (currentTime.getMinutes() == 00) {
            writer.append("\t" + STATUS_DATE_FORMAT.format(currentTime));

        }
        currentTime = getNextTime(currentTime);

    }

    for (String zone : allZones) {
        currentTime = STATUS_DATE_FORMAT.parse(start);
        endTime = STATUS_DATE_FORMAT.parse(end);
        double hourlyVehicles = 0;
        writer.newLine();
        writer.append(zone);
        while (!currentTime.equals(endTime)) {

            Matrix m = statusMatrices.getMatrix(STATUS_DATE_FORMAT.format(currentTime));
            if (m != null) {
                if (m.getFromLocations().containsKey(zone)) {
                    for (Entry entry : m.getFromLocEntries(zone)) {
                        switch (entry.getToLocation()) {
                        case "65":
                        case "70":
                        case "80":
                        case "83":
                        case "85": {
                            hourlyVehicles += entry.getValue();
                            break;
                        }
                        default:
                            break;

                        }
                    }
                }
            }
            if (zone.equals("1011401")) {
                System.out.println(STATUS_DATE_FORMAT.format(currentTime) + "\t" + hourlyVehicles);
            }
            if (currentTime.getMinutes() == 55) {
                writer.append("\t" + hourlyVehicles / 12.0);
                hourlyVehicles = 0;

            }

            currentTime = getNextTime(currentTime);
        }

    }
    writer.flush();
    writer.close();
}