當前位置: 首頁>>代碼示例>>Java>>正文


Java Calendar.AUGUST屬性代碼示例

本文整理匯總了Java中java.util.Calendar.AUGUST屬性的典型用法代碼示例。如果您正苦於以下問題:Java Calendar.AUGUST屬性的具體用法?Java Calendar.AUGUST怎麽用?Java Calendar.AUGUST使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.util.Calendar的用法示例。


在下文中一共展示了Calendar.AUGUST屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDaysInMonth

public static int getDaysInMonth(int month, int year) {
       switch (month) {
           case Calendar.JANUARY:
           case Calendar.MARCH:
           case Calendar.MAY:
           case Calendar.JULY:
           case Calendar.AUGUST:
           case Calendar.OCTOBER:
           case Calendar.DECEMBER:
               return 31;
           case Calendar.APRIL:
           case Calendar.JUNE:
           case Calendar.SEPTEMBER:
           case Calendar.NOVEMBER:
               return 30;
           case Calendar.FEBRUARY:
               return (year % 4 == 0) ? 29 : 28;
           default:
               throw new IllegalArgumentException("Invalid Month");
       }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:Utils.java

示例2: getDaysInMonth

public static int getDaysInMonth(int month, int year) {
    switch (month) {
        case Calendar.JANUARY:
        case Calendar.MARCH:
        case Calendar.MAY:
        case Calendar.JULY:
        case Calendar.AUGUST:
        case Calendar.OCTOBER:
        case Calendar.DECEMBER:
            return 31;
        case Calendar.APRIL:
        case Calendar.JUNE:
        case Calendar.SEPTEMBER:
        case Calendar.NOVEMBER:
            return 30;
        case Calendar.FEBRUARY:
            return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? 29 : 28;
        default:
            throw new IllegalArgumentException("Invalid Month");
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:CalendarUtils.java

示例3: getDaysInMonth

public static int getDaysInMonth(int month, int year) {
    switch (month) {
        case Calendar.JANUARY:
        case Calendar.MARCH:
        case Calendar.MAY:
        case Calendar.JULY:
        case Calendar.AUGUST:
        case Calendar.OCTOBER:
        case Calendar.DECEMBER:
            return 31;
        case Calendar.APRIL:
        case Calendar.JUNE:
        case Calendar.SEPTEMBER:
        case Calendar.NOVEMBER:
            return 30;
        case Calendar.FEBRUARY:
            return (year % 4 == 0) ? 29 : 28;
        default:
            throw new IllegalArgumentException("Invalid Month");
    }
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:21,代碼來源:Utils.java

示例4: getDaysInMonth

public static int getDaysInMonth(int month, int year) {
       switch (month) {
           case Calendar.JANUARY:
           case Calendar.MARCH:
           case Calendar.MAY:
           case Calendar.JULY:
           case Calendar.AUGUST:
           case Calendar.OCTOBER:
           case Calendar.DECEMBER:
               return 31;
           case Calendar.APRIL:
           case Calendar.JUNE:
           case Calendar.SEPTEMBER:
           case Calendar.NOVEMBER:
               return 30;
           case Calendar.FEBRUARY:
               return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? 28 : 29;
           default:
               throw new IllegalArgumentException("Invalid Month");
       }
}
 
開發者ID:yongbeam,項目名稱:AirCalendar,代碼行數:21,代碼來源:CalendarUtils.java

示例5: getDaysInMonth

/**
 * @param month 從0開始
 * @param year  年份
 * @return days
 */
public static int getDaysInMonth(int month, int year) {
    switch (month) {
        case Calendar.JANUARY:
        case Calendar.MARCH:
        case Calendar.MAY:
        case Calendar.JULY:
        case Calendar.AUGUST:
        case Calendar.OCTOBER:
        case Calendar.DECEMBER:
            return 31;
        case Calendar.APRIL:
        case Calendar.JUNE:
        case Calendar.SEPTEMBER:
        case Calendar.NOVEMBER:
            return 30;
        case Calendar.FEBRUARY:
            return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? 29 : 28;
        default:
            throw new IllegalArgumentException("Invalid Month");
    }
}
 
開發者ID:sieml,項目名稱:CalendarCheck,代碼行數:26,代碼來源:CalendarUtils.java

示例6: onNavigationButtonClicked

@Override
public Map<Integer, Object>[] onNavigationButtonClicked(int whichButton, Calendar newMonth) {
	Map<Integer, Object>[] arr = new Map[2];
	switch(newMonth.get(Calendar.MONTH)) {
		case Calendar.AUGUST:
			arr[0] = new HashMap<>(); //This is the map linking a date to its description
			arr[0].put(3, "unavailable");
			arr[0].put(6, "holiday");
			arr[0].put(21, "unavailable");
			arr[0].put(24, "holiday");
			arr[1] = null; //Optional: This is the map linking a date to its tag.
			break;
		case Calendar.JUNE:
			arr[0] = new HashMap<>();
			arr[0].put(5, "unavailable");
			arr[0].put(10, "holiday");
			arr[0].put(19, "holiday");
			break;
	}
	return arr;
}
 
開發者ID:naishadhparmar,項目名稱:zcustomcalendar,代碼行數:21,代碼來源:ActivityMain.java

示例7: getDaysInMonth

/**
 * 獲取月份的天數
 *
 * @param mills
 * @return
 */
public static int getDaysInMonth(long mills) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(mills);

    int year = calendar.get(Calendar.YEAR);
    int month = calendar.get(Calendar.MONTH);

    switch (month) {
        case Calendar.JANUARY:
        case Calendar.MARCH:
        case Calendar.MAY:
        case Calendar.JULY:
        case Calendar.AUGUST:
        case Calendar.OCTOBER:
        case Calendar.DECEMBER:
            return 31;
        case Calendar.APRIL:
        case Calendar.JUNE:
        case Calendar.SEPTEMBER:
        case Calendar.NOVEMBER:
            return 30;
        case Calendar.FEBRUARY:
            return (year % 4 == 0) ? 29 : 28;
        default:
            throw new IllegalArgumentException("Invalid Month");
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:33,代碼來源:Kits.java

示例8: getSeason

/**
 *
 * 1 第一季度 2 第二季度 3 第三季度 4 第四季度
 *
 * @param date
 * @return
 */
public static int getSeason(Date date) {

	int season = 0;

	Calendar c = Calendar.getInstance();
	c.setTime(date);
	int month = c.get(Calendar.MONTH);
	switch (month) {
	case Calendar.JANUARY:
	case Calendar.FEBRUARY:
	case Calendar.MARCH:
		season = 1;
		break;
	case Calendar.APRIL:
	case Calendar.MAY:
	case Calendar.JUNE:
		season = 2;
		break;
	case Calendar.JULY:
	case Calendar.AUGUST:
	case Calendar.SEPTEMBER:
		season = 3;
		break;
	case Calendar.OCTOBER:
	case Calendar.NOVEMBER:
	case Calendar.DECEMBER:
		season = 4;
		break;
	default:
		break;
	}
	return season;
}
 
開發者ID:xubinux,項目名稱:xbin-store,代碼行數:40,代碼來源:DateUtils.java

示例9: getSeason

/**
 * 
 * 1 第一季度 2 第二季度 3 第三季度 4 第四季度
 * 
 * @param date
 * @return
 */
public static int getSeason(Date date) {

	int season = 0;

	Calendar c = Calendar.getInstance();
	c.setTime(date);
	int month = c.get(Calendar.MONTH);
	switch (month) {
	case Calendar.JANUARY:
	case Calendar.FEBRUARY:
	case Calendar.MARCH:
		season = 1;
		break;
	case Calendar.APRIL:
	case Calendar.MAY:
	case Calendar.JUNE:
		season = 2;
		break;
	case Calendar.JULY:
	case Calendar.AUGUST:
	case Calendar.SEPTEMBER:
		season = 3;
		break;
	case Calendar.OCTOBER:
	case Calendar.NOVEMBER:
	case Calendar.DECEMBER:
		season = 4;
		break;
	default:
		break;
	}
	return season;
}
 
開發者ID:mumucommon,項目名稱:mumu-core,代碼行數:40,代碼來源:DateUtils.java

示例10: setMonth

/**
 * Set the month member
 * @param m String to set.
 * @throws IllegalArgumentException if m is not a valid month
 */
public void setMonth(String m) throws IllegalArgumentException {
    sipMonth = m;
    if (sipMonth.compareToIgnoreCase(JAN) == 0) {
        month = Calendar.JANUARY;
    } else if (sipMonth.compareToIgnoreCase(FEB) == 0) {
        month = Calendar.FEBRUARY;
    } else if (sipMonth.compareToIgnoreCase(MAR) == 0) {
        month = Calendar.MARCH;
    } else if (sipMonth.compareToIgnoreCase(APR) == 0) {
        month = Calendar.APRIL;
    } else if (sipMonth.compareToIgnoreCase(MAY) == 0) {
        month = Calendar.MAY;
    } else if (sipMonth.compareToIgnoreCase(JUN) == 0) {
        month = Calendar.JUNE;
    } else if (sipMonth.compareToIgnoreCase(JUL) == 0) {
        month = Calendar.JULY;
    } else if (sipMonth.compareToIgnoreCase(AUG) == 0) {
        month = Calendar.AUGUST;
    } else if (sipMonth.compareToIgnoreCase(SEP) == 0) {
        month = Calendar.SEPTEMBER;
    } else if (sipMonth.compareToIgnoreCase(OCT) == 0) {
        month = Calendar.OCTOBER;
    } else if (sipMonth.compareToIgnoreCase(NOV) == 0) {
        month = Calendar.NOVEMBER;
    } else if (sipMonth.compareToIgnoreCase(DEC) == 0) {
        month = Calendar.DECEMBER;
    } else {
        throw new IllegalArgumentException("Illegal Month :" + m);
    }
}
 
開發者ID:YunlongYang,項目名稱:LightSIP,代碼行數:35,代碼來源:SIPDate.java

示例11: getSeasonStartYearFromDate

public static int getSeasonStartYearFromDate(Calendar calendar) {
    if (calendar.get(Calendar.MONTH) >= Calendar.AUGUST) {
        return calendar.get(Calendar.YEAR);
    } else {
        return calendar.get(Calendar.YEAR) - 1;
    }
}
 
開發者ID:suomenriistakeskus,項目名稱:oma-riista-android,代碼行數:7,代碼來源:DateTimeUtils.java

示例12: getMonth

private static int getMonth(String monthString) {
    int hash = Character.toLowerCase(monthString.charAt(0)) +
            Character.toLowerCase(monthString.charAt(1)) +
            Character.toLowerCase(monthString.charAt(2)) - 3 * 'a';
    switch (hash) {
        case 22:
            return Calendar.JANUARY;
        case 10:
            return Calendar.FEBRUARY;
        case 29:
            return Calendar.MARCH;
        case 32:
            return Calendar.APRIL;
        case 36:
            return Calendar.MAY;
        case 42:
            return Calendar.JUNE;
        case 40:
            return Calendar.JULY;
        case 26:
            return Calendar.AUGUST;
        case 37:
            return Calendar.SEPTEMBER;
        case 35:
            return Calendar.OCTOBER;
        case 48:
            return Calendar.NOVEMBER;
        case 9:
            return Calendar.DECEMBER;
        default:
            throw new IllegalArgumentException();
    }
}
 
開發者ID:snoozinsquatch,項目名稱:unity-obb-downloader,代碼行數:33,代碼來源:HttpDateTime.java

示例13: Test4278609

public void Test4278609() {
    SimpleTimeZone tz = new SimpleTimeZone(0, "MyTimeZone",
                           /* DST start day: August, 1, 0:00 */
                           Calendar.AUGUST, 1, 0, 0,
                           /* DST end day: January, 1, 0:00 (wall-clock)*/
                           Calendar.JANUARY, 1, 0, 0,
                           60 * 60 * 1000);

    Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));

    // setting a date using GMT zone just after the end rule of tz zone
    cal.clear();
    cal.set(Calendar.ERA, GregorianCalendar.AD);
    cal.set(1998, Calendar.DECEMBER, 31, 23, 01, 00);

    Date date = cal.getTime();

    int millis = cal.get(Calendar.HOUR_OF_DAY) * 3600000
                 + cal.get(Calendar.MINUTE) * 60000
                 + cal.get(Calendar.SECOND) * 1000
                 + cal.get(Calendar.MILLISECOND);
    /* we must use standard local time */
    millis += tz.getRawOffset();

    int offset = tz.getOffset(cal.get(Calendar.ERA),
                              cal.get(Calendar.YEAR),
                              cal.get(Calendar.MONTH),
                              cal.get(Calendar.DATE),
                              cal.get(Calendar.DAY_OF_WEEK),
                              millis);

    if (offset != 0) {
        SimpleDateFormat format = new SimpleDateFormat("dd MMM HH:mm:ss zzz",
                                                       Locale.US);
        format.setTimeZone(tz);
        errln("Wrong DST transition: " + tz
              + "\na date just after DST = " + format.format(date)
              + "\ngetOffset = " + offset);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:40,代碼來源:TransitionTest.java

示例14: getMonth

/***
 * Gets the name of the month from the given date.
 *
 * @param date ISO format date
 * @return Returns the name of the month
 */
public static String getMonth(String date) {
    Date dateDT = parseDate(date);

    if (dateDT == null) {
        return null;
    }

    // Get current date
    Calendar c = Calendar.getInstance();
    // it is very important to
    // set the date of
    // the calendar.
    c.setTime(dateDT);
    int day = c.get(Calendar.MONTH);

    String dayStr = null;

    switch (day) {

        case Calendar.JANUARY:
            dayStr = "January";
            break;

        case Calendar.FEBRUARY:
            dayStr = "February";
            break;

        case Calendar.MARCH:
            dayStr = "March";
            break;

        case Calendar.APRIL:
            dayStr = "April";
            break;

        case Calendar.MAY:
            dayStr = "May";
            break;

        case Calendar.JUNE:
            dayStr = "June";
            break;

        case Calendar.JULY:
            dayStr = "July";
            break;

        case Calendar.AUGUST:
            dayStr = "August";
            break;

        case Calendar.SEPTEMBER:
            dayStr = "September";
            break;

        case Calendar.OCTOBER:
            dayStr = "October";
            break;

        case Calendar.NOVEMBER:
            dayStr = "November";
            break;

        case Calendar.DECEMBER:
            dayStr = "December";
            break;
    }

    return dayStr;
}
 
開發者ID:rushdroid,項目名稱:SharedPermission,代碼行數:76,代碼來源:DateUtil.java

示例15: getMonthAbbreviated

/**
 * Gets abbreviated name of the month from the given date.
 *
 * @param date ISO format date
 * @return Returns the name of the month
 */
public static String getMonthAbbreviated(String date) {
    Date dateDT = parseDate(date);

    if (dateDT == null) {
        return null;
    }

    // Get current date
    Calendar c = Calendar.getInstance();
    // it is very important to
    // set the date of
    // the calendar.
    c.setTime(dateDT);
    int day = c.get(Calendar.MONTH);

    String dayStr = null;

    switch (day) {

        case Calendar.JANUARY:
            dayStr = "Jan";
            break;

        case Calendar.FEBRUARY:
            dayStr = "Feb";
            break;

        case Calendar.MARCH:
            dayStr = "Mar";
            break;

        case Calendar.APRIL:
            dayStr = "Apr";
            break;

        case Calendar.MAY:
            dayStr = "May";
            break;

        case Calendar.JUNE:
            dayStr = "Jun";
            break;

        case Calendar.JULY:
            dayStr = "Jul";
            break;

        case Calendar.AUGUST:
            dayStr = "Aug";
            break;

        case Calendar.SEPTEMBER:
            dayStr = "Sep";
            break;

        case Calendar.OCTOBER:
            dayStr = "Oct";
            break;

        case Calendar.NOVEMBER:
            dayStr = "Nov";
            break;

        case Calendar.DECEMBER:
            dayStr = "Dec";
            break;
    }

    return dayStr;
}
 
開發者ID:rushdroid,項目名稱:SharedPermission,代碼行數:76,代碼來源:DateUtil.java


注:本文中的java.util.Calendar.AUGUST屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。