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

public static String getXMLDateString() {
    Date date = new Date();
    // YYYY-MM-DDThh:mm:ss

    // Must be a simpler way to do this....
    String xmlDateFormat = "" + (date.getYear() + 1900);
    int month = (date.getMonth() + 1);
    String monthStr = fillZero(month);
    String dateStr = fillZero(date.getDate());
    xmlDateFormat = xmlDateFormat + "-" + monthStr;
    xmlDateFormat = xmlDateFormat + "-" + dateStr;
    xmlDateFormat = xmlDateFormat + "T" + fillZero(date.getHours());
    xmlDateFormat = xmlDateFormat + ":" + fillZero(date.getMinutes());
    xmlDateFormat = xmlDateFormat + ":" + fillZero(date.getSeconds());

    return (xmlDateFormat);
}

From source file:Main.java

static public void appendDateNode(Document owner, Element appendElement, String name, Date date) {
    Element dateElem = owner.createElement(name);
    appendElement.appendChild(dateElem);
    appendSingleValElement(owner, dateElem, "month", Integer.toString(date.getMonth() + 1));
    appendSingleValElement(owner, dateElem, "day", Integer.toString(date.getDate()));
    appendSingleValElement(owner, dateElem, "year", Integer.toString(date.getYear() + 1900));
    appendSingleValElement(owner, dateElem, "hour", Integer.toString(date.getHours()));
    appendSingleValElement(owner, dateElem, "minute", Integer.toString(date.getMinutes()));
    appendSingleValElement(owner, dateElem, "second", Integer.toString(date.getSeconds()));
}

From source file:cn.ipanel.apps.portalBackOffice.util.CommonsFiend.java

public static String[] getUpdateTime() {
    Date date = Calendar.getInstance().getTime();
    date.setMinutes(date.getMinutes() + 1);
    String[] returnTime = new String[2];
    returnTime[0] = DateFormatUtils.format(date, Defines.FORMAT_DATE_TIME_STRING);
    date.setHours(23);//w w w.ja  va 2 s .  c  o  m
    date.setMinutes(59);
    date.setSeconds(59);
    returnTime[1] = DateFormatUtils.format(date, Defines.FORMAT_DATE_TIME_STRING);
    return returnTime;
}

From source file:org.nuclos.common2.DateUtils.java

/**
 * @param date is not altered.//from w  w w.  j  av a2  s .c  om
 * @return Is the given date pure?
 * @precondition date != null
 * @postcondition result --> date.getHours() == 0
 * @postcondition result --> date.getMinutes() == 0
 * @postcondition result --> date.getSeconds() == 0
 * @see   #getPureDate(Date)
 */
public static boolean isPure(Date date) {
    final boolean result = date.equals(getPureDate(date));
    assert !result || date.getHours() == 0;
    assert !result || date.getMinutes() == 0;
    assert !result || date.getSeconds() == 0;
    return result;
}

From source file:DateUtil.java

/**
  * Checks the second, hour, month, day, month and year are equal.
  *//*from w  w w  .j ava  2  s  .  c  om*/
public static boolean dateTimeEquals(java.util.Date d1, java.util.Date d2) {
    if (d1 == null || d2 == null)
        return false;

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

From source file:com.fluidops.iwb.api.ValueResolver.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  .ja v a 2s. c o m*/
 * @param sysdate
 * @return
 */
public static String resolveSysDate(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:com.eryansky.common.utils.StringUtils.java

/**
 * ???//  w  w w .j  av a2 s .  c om
 * 
 * @param time
 * @return
 */
@SuppressWarnings("deprecation")
public static String processTime(Long time) {
    long oneDay = 24 * 60 * 60 * 1000;
    Date now = new Date();
    Date orginalTime = new Date(time);
    long nowDay = now.getTime() - (now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds()) * 1000;
    long yesterday = nowDay - oneDay;
    String nowHourAndMinute = toDoubleDigit(orginalTime.getHours()) + ":"
            + toDoubleDigit(orginalTime.getMinutes());
    if (time >= now.getTime()) {
        return "";
    } else if ((now.getTime() - time) < (60 * 1000)) {
        return (now.getTime() - time) / 1000 + "? " + nowHourAndMinute + " ";
    } else if ((now.getTime() - time) < (60 * 60 * 1000)) {
        return (now.getTime() - time) / 1000 / 60 + "? " + nowHourAndMinute + " ";
    } else if ((now.getTime() - time) < (24 * 60 * 60 * 1000)) {
        return (now.getTime() - time) / 1000 / 60 / 60 + "?? " + nowHourAndMinute + " ";
    } else if (time >= nowDay) {
        return " " + nowHourAndMinute;
    } else if (time >= yesterday) {
        return " " + nowHourAndMinute;
    } else {
        return toDoubleDigit(orginalTime.getMonth()) + "-" + toDoubleDigit(orginalTime.getDate()) + " "
                + nowHourAndMinute + ":" + toDoubleDigit(orginalTime.getSeconds());
    }
}

From source file:com.cssweb.quote.util.Utils.java

public static String format(Date date) {
    String str = "";
    str = date.getYear() + "-" + formatTwo(date.getMonth() + 1) + "-" + formatTwo(date.getDate()) + " "
            + formatTwo(date.getHours()) + ":" + formatTwo(date.getMinutes()) + ":00";
    return str;/*w ww .  j a  va  2s  . c  o m*/
}

From source file:org.nuclos.common2.DateUtils.java

/**
 * @param date is not changed by this method. May be <code>null</code>.
 * @return the pure date (aka "day", that is the date without time of day) of the given Date object (if any).
 * @postcondition date != null <--> result != null
 * @postcondition date != null --> result.getHours() == 0
 * @postcondition date != null --> result.getMinutes() == 0
 * @postcondition date != null --> result.getSeconds() == 0
 * @todo consider calling this method getDay(). On the other hand, that name could be confused with Date.getDay()...
 *//*from  ww  w  . j a v  a  2  s .  c o m*/
public static Date getPureDate(Date date) {
    final Date result = (date == null) ? null
            : org.apache.commons.lang.time.DateUtils.truncate(date, Calendar.DATE);
    assert (date != null) == (result != null);

    assert (date == null) || result.getHours() == 0;
    assert (date == null) || result.getMinutes() == 0;
    assert (date == null) || result.getSeconds() == 0;
    return result;
}

From source file:org.nerve.utils.StringUtils.java

/**
 * ???//from  w ww .j  ava  2 s .co m
 *
 * @param time      
 * @return
 */
public static String processTime(Long time) {
    long oneDay = 24 * 60 * 60 * 1000;
    Date now = new Date();
    Date orginalTime = new Date(time);
    long nowDay = now.getTime() - (now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds()) * 1000;
    long yesterday = nowDay - oneDay;
    String nowHourAndMinute = toDoubleDigit(orginalTime.getHours()) + ":"
            + toDoubleDigit(orginalTime.getMinutes());
    if (time >= now.getTime()) {
        return "";
    } else if ((now.getTime() - time) < (60 * 1000)) {
        return (now.getTime() - time) / 1000 + "? " + nowHourAndMinute + " ";
    } else if ((now.getTime() - time) < (60 * 60 * 1000)) {
        return (now.getTime() - time) / 1000 / 60 + "? " + nowHourAndMinute + " ";
    } else if ((now.getTime() - time) < (24 * 60 * 60 * 1000)) {
        return (now.getTime() - time) / 1000 / 60 / 60 + "?? " + nowHourAndMinute + " ";
    } else if (time >= nowDay) {
        return " " + nowHourAndMinute;
    } else if (time >= yesterday) {
        return " " + nowHourAndMinute;
    } else {
        return toDoubleDigit(orginalTime.getMonth()) + "-" + toDoubleDigit(orginalTime.getDate()) + " "
                + nowHourAndMinute + ":" + toDoubleDigit(orginalTime.getSeconds());
    }
}