Java Utililty Methods Date to Month

List of utility methods to do Date to Month

Description

The list of methods to do Date to Month are organized into topic(s).

Method

DategetMonday(Date date)
get Monday
Calendar c = Calendar.getInstance();
c.setTime(date);
c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
return c.getTime();
StringgetMondayDate(String date)
get Monday Date
String startDate;
int year = getYear(date);
int month = getMonth(date);
int day = getDate(date);
int curDayOfWeek = getDayOfWeek(year, month, day);
int startTmp = 2 - curDayOfWeek;
if (startTmp == 0)
    return date;
...
StringgetMontByDate(Date curDate)
get Mont By Date
if (curDate == null)
    return "";
Calendar cal = Calendar.getInstance();
cal.setTime(curDate);
int monthNum = cal.get(Calendar.MONTH) + 1;
return Integer.toString(monthNum);
IntegergetMonth(Date aDate)
get Month
Calendar cal = new GregorianCalendar();
cal.setTime(aDate);
return new Integer(cal.get(Calendar.MONTH) + 1);
intgetMonth(Date d)
get Month
if (d == null)
    return 0;
final Calendar c = new GregorianCalendar();
c.setTime(d);
return c.get(Calendar.MONTH) + 1;
intgetMonth(Date d)
Jan = 1 ...
Calendar c = getCalendar();
c.setTime(d);
return (c.get(Calendar.MONTH) + 1);
Date[]getMonth(Date d)
get Month
Date[] dS = new Date[2];
Calendar calendar = Calendar.getInstance();
calendar.setTime(d);
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
dS[0] = calendar.getTime();
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
dS[1] = calendar.getTime();
return dS;
...
intgetMonth(Date d)
get Month
Calendar c = Calendar.getInstance();
c.setTime(d);
return c.get(Calendar.MONTH) + 1;
IntegergetMonth(Date date)
get Month
if (date == null) {
    return null;
Calendar ca = Calendar.getInstance();
ca.setTime(date);
return Integer.valueOf(ca.get(MONTH) + 1);
intgetMonth(Date date)
Get the month of the specified date.
GregorianCalendar cal = getCalender(date, false);
return cal.get(Calendar.MONTH);