Example usage for java.util Date getHours

List of usage examples for java.util Date getHours

Introduction

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

Prototype

@Deprecated
public int getHours() 

Source Link

Document

Returns the hour represented by this Date object.

Usage

From source file:Main.java

public static int getHourOfDay() {
    Calendar cal = Calendar.getInstance();
    Date date = cal.getTime();
    return date.getHours();
}

From source file:Main.java

public static final int getHourByMill(long mill) {
    Date curDate = new Date(mill);
    return curDate.getHours();
}

From source file:Main.java

@SuppressWarnings("deprecation")
public static int minutesFromDate(Date date) {
    return date.getHours() * 60 + date.getMinutes();
}

From source file:Main.java

/**
 * 06??-18?? ????/*  www. jav  a2s . c o m*/
 * 
 * @return
 */
public static boolean isBaitian() {
    Date d = new Date();
    int hours = d.getHours();
    if (6 < hours && hours < 18) {
        return true;
    } else {
        return false;
    }
}

From source file:Main.java

public static int dateToTimeValue(Date date) {
    return dateToTimeValue(date.getHours(), date.getMinutes());
}

From source file:Main.java

public static final int getPhoneHour() {
    Date curDate = new Date(System.currentTimeMillis());
    return curDate.getHours();
}

From source file:Main.java

public static String timeToReadableString(Date date) {
    String returned = "";
    if (date.getHours() < 10)
        returned += "0" + date.getHours();
    else/* w  ww  .j ava 2  s . c o  m*/
        returned += date.getHours();
    returned += ":";
    if (date.getMinutes() < 10)
        returned += "0" + date.getMinutes();
    else
        returned += date.getMinutes();
    return returned;
}

From source file:Main.java

public static String getTimeQuantum(String strDate, String format) {
    Date mDate = getDateByFormat(strDate, format);
    int hour = mDate.getHours();
    if (hour >= 12)
        return "PM";
    else/*w  w  w  . j  a va  2s . c  o m*/
        return "AM";
}

From source file:Main.java

/**
 * @param date// ww w  .j a v  a2 s .  c om
 *
 * @return
 */
public static String getFormatedDate(Date date) {
    return date.getYear() + "-" + date.getMonth() + "-" + date.getDay() + " - At " + date.getHours() + ":"
            + date.getMinutes();
}

From source file:Main.java

public static String getTimeQuantum(String strDate, String format) {
    Date mDate = getDateByFormat(strDate, format);
    @SuppressWarnings("deprecation")
    int hour = mDate.getHours();
    if (hour >= 12)
        return "PM";
    else//from  ww  w.  j a  v  a 2 s . com
        return "AM";
}