Example usage for java.util Calendar YEAR

List of usage examples for java.util Calendar YEAR

Introduction

In this page you can find the example usage for java.util Calendar YEAR.

Prototype

int YEAR

To view the source code for java.util Calendar YEAR.

Click Source Link

Document

Field number for get and set indicating the year.

Usage

From source file:Main.java

public static String year() {
    Calendar cal = Calendar.getInstance();
    return String.valueOf(cal.get(Calendar.YEAR));
}

From source file:Main.java

public static String getFlushYear() {
    Calendar cal = Calendar.getInstance();
    int i = cal.get(Calendar.YEAR);
    String s = Integer.toString(i);
    return s;/* w  w w .j av a 2 s  .  c  o m*/
}

From source file:Main.java

public static int getYear() {
    return getCalendar(getCurrentDate()).get(Calendar.YEAR);
}

From source file:Main.java

public static long getTimesMonthStart() {
    Calendar cal = Calendar.getInstance();
    cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
    cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
    return cal.getTimeInMillis();
}

From source file:Main.java

public static String getCurrentTime() {
    Calendar c = Calendar.getInstance();
    int year = c.get(Calendar.YEAR);
    int month = c.get(Calendar.MONTH) + 1;
    int day = c.get(Calendar.DAY_OF_MONTH);
    String time = year + "-" + month + "-" + day;
    return time;//from   w  w w.j a v a 2s  .  com
}

From source file:Main.java

public static int getCurrentMouth() {
    Calendar cal = Calendar.getInstance();
    int year = cal.get(Calendar.YEAR);
    int mouth = cal.get(Calendar.MONTH);
    int day = cal.get(Calendar.DATE);
    int currentIndex = (year - 1970) * 12 + mouth;
    return currentIndex;
}

From source file:Main.java

public static String getNow() {
    final Calendar calendar = Calendar.getInstance();
    return calendar.get(Calendar.YEAR) + "/" + calendar.get(Calendar.MONTH) + 1 + "/"
            + calendar.get(Calendar.DAY_OF_MONTH) + "/" + " " + calendar.get(Calendar.HOUR_OF_DAY) + ":"
            + calendar.get(Calendar.MINUTE) + ":" + calendar.get(Calendar.SECOND);
}

From source file:Main.java

public static int getYear() {
    return calendar.get(Calendar.YEAR);
}

From source file:Main.java

public static long getTimesMonthNextStart() {
    Calendar cal = Calendar.getInstance();
    cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
    cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
    cal.set(Calendar.HOUR_OF_DAY, 24);
    return cal.getTimeInMillis();
}

From source file:Main.java

public static int getdataCount(int year, int month) {
    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.YEAR, year);
    cal.set(Calendar.MONTH, month - 1);
    int count = cal.getActualMaximum(Calendar.DATE);
    return count;
}