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

StringgetStrThisMonth()
get Str This Month
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMM");
Calendar cd = Calendar.getInstance();
return simpleDateFormat.format(cd.getTime());
StringgetThisMonth()
get This Month
String dateString = "";
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("MM");
java.util.Date currentTime_1 = new java.util.Date();
dateString = formatter.format(currentTime_1);
return dateString;
ListgetThisMonth()
get This Month
return getThisMonth(DEFAULT_DATE_FORMAT);
StringgetThisMonth()
get This Month
String dateString = "";
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("MM");
java.util.Date currentTime_1 = new java.util.Date();
dateString = formatter.format(currentTime_1);
return dateString;
int[]getThisMonthAndCycle()
get This Month And Cycle
int cycle = 1;
String str = new SimpleDateFormat("yyyyMMdd").format(new Date());
int month = Integer.valueOf(str.substring(0, 6));
int day = Integer.valueOf(str.substring(6, 8));
if (day <= 10) {
    cycle = 1;
if (day > 10 && day <= 20) {
...
StringgetThisMonthDate()
get This Month Date
Date now = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/");
return dateFormat.format(now) + "01 00:00:00";
intgetThisMonthLastDate()
get This Month Last Date
Calendar calendar = Calendar.getInstance();
Calendar cpcalendar = (Calendar) calendar.clone();
cpcalendar.set(Calendar.DAY_OF_MONTH, 1);
cpcalendar.add(Calendar.MONTH, 1);
cpcalendar.add(Calendar.DATE, -1);
return Integer.parseInt(intSDF.format(new Date(cpcalendar.getTimeInMillis())));
longgetTsOfMonth(Date date, boolean isEnd, boolean isPrevious)
get Ts Of Month
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
if (isEnd) {
    if (isPrevious) {
        calendar.add(Calendar.MONTH, -1);
    calendar.set(Calendar.DATE, calendar.getActualMaximum(Calendar.DATE));
...
intgetWeekOfMonth(String datetime)
get Week Of Month
String start = datetime.substring(0, 8) + "01";
Date day = parseDate(datetime);
int i = 7;
int w = 1;
while (true) {
    if (day.getTime() < addDay(start, i).getTime()) {
        return w;
    i = i + 7;
    w++;
DategetWorkMonthLastDay(Date date)
get Work Month Last Day
Calendar temp = Calendar.getInstance();
temp.setTime(date);
int y = temp.get(Calendar.YEAR);
int m = temp.get(Calendar.MONTH) + 1;
int d = temp.get(Calendar.DAY_OF_MONTH);
int ry = 0, rm = 0, rd = 0;
if (d >= 1 && d <= 20) {
    rm = m;
...