Example usage for java.util Calendar DATE

List of usage examples for java.util Calendar DATE

Introduction

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

Prototype

int DATE

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

Click Source Link

Document

Field number for get and set indicating the day of the month.

Usage

From source file:Main.java

public static int getCurrentDay() {
    Calendar cal = Calendar.getInstance();
    int day = cal.get(Calendar.DATE);
    return day;//from  w  w w.j  a  v a  2s.c  om
}

From source file:Main.java

public static int getNowDay() {
    Calendar calendar = Calendar.getInstance();
    return calendar.get(Calendar.DATE);
}

From source file:Main.java

public static boolean checkFirstDayOfMonth() {
    Calendar c = Calendar.getInstance();
    return (c.get(Calendar.DATE) == 1);
}

From source file:Main.java

public static Date getLastWeekTime() {
    Calendar c = Calendar.getInstance();
    c.add(Calendar.DATE, -6);
    return c.getTime();
}

From source file:Main.java

public static Date getYesterday() {
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.DATE, -1);
    return cal.getTime();
}

From source file:Main.java

public static String getCurrentDateString() {
    Calendar date = Calendar.getInstance();
    int day = date.get(Calendar.DATE);
    int month = (date.get(Calendar.MONTH)) + 1;
    int year = date.get(Calendar.YEAR);
    String dateString = month + "-" + day + "-" + year;
    return dateString;
}

From source file:Main.java

public static String yesterday() {
    Calendar c = Calendar.getInstance();
    c.add(Calendar.DATE, -1);
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    return df.format(c.getTime());
}

From source file:Main.java

public static String getPhoneDay() {
    return "" + (calendar.get(Calendar.DATE));
}

From source file:Main.java

private static Date get6DaysAgo() {
    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.DATE, -6);

    return calendar.getTime();
}

From source file:Main.java

public static int getDaysByYearMonth(Calendar calendar) {
    return calendar.getActualMaximum(Calendar.DATE);
}