Java Utililty Methods Month Day

List of utility methods to do Month Day

Description

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

Method

StringgetMonthEndDay(String time)
get Month End Day
String ntime = "";
try {
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    Date startDate = df.parse(time);
    int nowMonth = startDate.getMonth() + 1;
    int nextMonth = nowMonth + 1;
    int nowYear = startDate.getYear() + 1900;
    String nextTime = nowYear + "-" + nextMonth + "-1";
...
StringgetMonthEndDay(String yyyy, String mm)
get Month End Day
if (yyyy == null || yyyy.trim().equals("")) {
    yyyy = getYear();
if (mm == null || mm.trim().equals("")) {
    mm = getMonth();
int year = Integer.parseInt(yyyy);
int month = Integer.parseInt(mm);
...
DategetMonthFirstDay()
get Month First Day
int mondayPlus;
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.set(Calendar.DAY_OF_MONTH, 1);
return getDate(cal.getTime());
StringgetMonthFirstDay()
get Month First Day
Date date = new Date();
int nowMonth = date.getMonth() + 1;
int nowYear = date.getYear() + 1900;
String startTime = nowYear + "-" + nowMonth + "-1";
return startTime;
DategetMonthFirstDay(Date date)
get Month First Day
Calendar c = Calendar.getInstance();
c.setTime(date);
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
c.clear();
c.set(Calendar.YEAR, year);
c.set(Calendar.MONTH, month);
c.set(Calendar.DAY_OF_MONTH, 1);
...
DategetMonthFirstDay(String date)
get Month First Day
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
Date d = null;
try {
    d = format.parse(date);
} catch (Exception e) {
    e.printStackTrace();
Calendar cal = Calendar.getInstance();
...
TgetMonthFirstDay(T date)
get Month First Day
if (date == null)
    return null;
String dateStr = format(date, "yyyy-MM") + "-01";
Long mill = parseDate(dateStr).getTime();
T another = (T) date.clone();
another.setTime(mill);
return another;
DategetMonthFristWeekSunday(String month)
get Month Frist Week Sunday
Calendar c = Calendar.getInstance();
c.setTime(parse(month, "yyyy-MM"));
c.set(Calendar.DATE, 1);
int dayNum = c.get(Calendar.DAY_OF_WEEK);
c.add(Calendar.DATE, 1 - dayNum);
return c.getTime();
StringgetMonthLastDay()
get Month Last Day
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
return convertDate(calendar.getTimeInMillis());
StringgetMonthLastDay()
get Month Last Day
SimpleDateFormat sdf = new SimpleDateFormat("dd");
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
return sdf.format(calendar.getTime());