Example usage for java.util Calendar DAY_OF_MONTH

List of usage examples for java.util Calendar DAY_OF_MONTH

Introduction

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

Prototype

int DAY_OF_MONTH

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

Click Source Link

Document

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

Usage

From source file:Main.java

public static Calendar getNowCalendar(int afterDay) {
    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.DAY_OF_MONTH, afterDay);
    return calendar;
}

From source file:Main.java

public static int getCurrentDayOfMonth() {
    Calendar calendar = Calendar.getInstance();
    int currDay = calendar.get(Calendar.DAY_OF_MONTH);
    return currDay;
}

From source file:Main.java

public static String getCurrentDayOfMonth() {
    Calendar calendar = Calendar.getInstance();
    return ((Integer) calendar.get(Calendar.DAY_OF_MONTH)).toString();
}

From source file:Main.java

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

From source file:Main.java

public static int getDay() {
    Calendar now = Calendar.getInstance();
    return now.get(Calendar.DAY_OF_MONTH);
}

From source file:Main.java

public static int getCurrentDayOfMonthFromTimestamp() {
    Calendar currentTime = Calendar.getInstance();
    return currentTime.get(Calendar.DAY_OF_MONTH);
}

From source file:Main.java

public static long endOfThisMonth() {
    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.DAY_OF_MONTH, 1);
    cal.set(Calendar.HOUR_OF_DAY, 23);
    cal.set(Calendar.MINUTE, 59);
    cal.set(Calendar.SECOND, 59);
    cal.set(Calendar.MILLISECOND, 999);
    cal.add(Calendar.MONTH, 1);//from   w  ww.j a va2s  .c  o  m
    cal.add(Calendar.DATE, -1);
    Date date = cal.getTime();
    return date.getTime();
}

From source file:Main.java

private static Boolean isThisDayOfMonth(Calendar calendar) {
    Calendar nowCalendar = Calendar.getInstance();
    return calendar.get(Calendar.DAY_OF_MONTH) == nowCalendar.get(Calendar.DAY_OF_MONTH);
}

From source file:Main.java

public static int getCurrentMaxNumOfMonth() {
    return calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
}

From source file:Main.java

public static Calendar GetThisMonthLeftRange(Calendar today) {
    Calendar calendar = (Calendar) today.clone();
    calendar.set(Calendar.DAY_OF_MONTH, 1);
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MILLISECOND, 0);
    calendar.add(Calendar.MINUTE, 0);
    return calendar;
}