Java Utililty Methods Month Get

List of utility methods to do Month Get

Description

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

Method

StringcurrentMonth()
current Month
return yyyyMM.format(new Date());
StringcurrentMonthStr()
current Month Str
return getTimeForMormat(new Date(), FORMAT_MONTH);
StringgetAktMonthName()
get Akt Month Name
return MONTHS[Calendar.getInstance().get(Calendar.MONTH)];
ListgetAllMonths(String date1, String date2)
get All Months
date1 = date2String1(string2Date(date1)) + "-01";
date2 = date2String1(string2Date(date2)) + "-01";
List list = new ArrayList();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar startDay = Calendar.getInstance();
Calendar endDay = Calendar.getInstance();
try {
    startDay.setTime(format.parse(date1));
...
StringgetBeforeMonth(int amount)
get Before Month
SimpleDateFormat daytime = new SimpleDateFormat("yyyyMM");
Calendar cal = Calendar.getInstance();
cal.setTime(cal.getTime());
cal.add(Calendar.MONTH, -amount);
String month = daytime.format(cal.getTime());
return month;
StringgetBeforeOrAfterDate(String strDate, int months)
get Before Or After Date
DateFormat df2 = new SimpleDateFormat("yyyy-MM-dd");
Date date = null;
try {
    date = df2.parse(strDate);
} catch (ParseException e) {
    e.printStackTrace();
Calendar cal = Calendar.getInstance();
...
LonggetCurMonth2Long()
get Cur Month Long
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MM");
return Long.parseLong(sdf.format(date));
StringgetCurrMonthLastDay()
get Curr Month Last Day
ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String last = format.format(ca.getTime());
return last;
DategetEndDateOfMonth(String yyyymmdd)
get End Date Of Month
SimpleDateFormat sformat = new SimpleDateFormat("yyyy-MM-dd");
String yyyymm = yyyymmdd.substring(0, 7);
int year = Integer.parseInt(yyyymm.substring(0, 4));
int month = Integer.parseInt(yyyymm.substring(5));
String endDate = "31";
if (month == 2)
    if (year % 4 == 0)
        endDate = "29";
...
StringgetEngMonth()
get Eng Month
GregorianCalendar calendar = new GregorianCalendar();
SimpleDateFormat monthForm = new SimpleDateFormat("MMMMM", Locale.ENGLISH);
return monthForm.format(calendar.getTime());