当前位置: 首页>>代码示例>>Java>>正文


Java Calendar.DECEMBER属性代码示例

本文整理汇总了Java中java.util.Calendar.DECEMBER属性的典型用法代码示例。如果您正苦于以下问题:Java Calendar.DECEMBER属性的具体用法?Java Calendar.DECEMBER怎么用?Java Calendar.DECEMBER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.util.Calendar的用法示例。


在下文中一共展示了Calendar.DECEMBER属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例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) ? 29 : 28;
           default:
               throw new IllegalArgumentException("Invalid Month");
       }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:Utils.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 && year % 100 != 0) || (year % 400 == 0)) ? 29 : 28;
        default:
            throw new IllegalArgumentException("Invalid Month");
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:CalendarUtils.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

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:MOLO17,项目名称:CustomizableCalendar,代码行数:21,代码来源:DateUtils.java

示例6: 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

示例7: getElapsedMonths

/**
 * Returns the time elapsed so far this month and the last numMonths months in milliseconds.
 *
 * @param numMonths Additional number of months prior to the current month to calculate.
 * @return Time elapsed this month and the last numMonths months in milliseconds.
 */
public long getElapsedMonths(int numMonths) {
    // Today + rest of this month
    long elapsed = getElapsedMonth();

    // Previous numMonths months
    int month = calendar.get(Calendar.MONTH);
    int year = calendar.get(Calendar.YEAR);
    for (int i = 0; i < numMonths; i++) {
        month--;

        if (month < Calendar.JANUARY) {
            month = Calendar.DECEMBER;
            year--;
        }

        elapsed += getDaysInMonth(year, month) * MS_PER_DAY;
    }

    return elapsed;
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:26,代码来源:CalendarUtil.java

示例8: doRenderLayer

@SideOnly(Side.CLIENT)
@Override
public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
    if (!Arrays.asList(contributors.uuid).contains(entitylivingbaseIn.getUniqueID().toString())) return;
    if (!entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE)) return;
    GlStateManager.pushMatrix();
    GlStateManager.enableBlend();
    GlStateManager.disableCull();
    RenderHelper.disableStandardItemLighting();
    if (Minecraft.isAmbientOcclusionEnabled()) {
        GlStateManager.shadeModel(GL11.GL_SMOOTH);
    } else {
        GlStateManager.shadeModel(GL11.GL_FLAT);
    }
    GlStateManager.translate(0, -0.015f, 0);
    if (!entitylivingbaseIn.inventory.armorInventory.get(3).isEmpty()) GlStateManager.translate(0, -0.02f, 0);
    if (entitylivingbaseIn.isSneaking()) GlStateManager.translate(0, 0.27, 0);
    GlStateManager.rotate(90, 0, 1, 0);
    GlStateManager.rotate(180, 1, 0, 0);
    GlStateManager.rotate(netHeadYaw, 0, -1, 0);
    GlStateManager.rotate(headPitch, 0, 0, -1);

    Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    Calendar calendar = Calendar.getInstance();
    if (calendar.get(Calendar.MONTH) == Calendar.OCTOBER) {
        spookyScarySkeletons();
    } else if (calendar.get(Calendar.MONTH) == Calendar.DECEMBER) {
        itsSnowyHere();
    } else {
        Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(ClientProxy.ears_baked, 0.5f, 255, 255, 255);
    }
    RenderHelper.enableStandardItemLighting();
    GlStateManager.depthMask(true);
    GlStateManager.popMatrix();
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:35,代码来源:ContributorsCatEarsRender.java

示例9: 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:ruiqiao2017,项目名称:Renrentou,代码行数:33,代码来源:Kits.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: Week

/**
 * Creates a time period for the week in which the specified date/time falls, calculated
 * relative to the specified time zone.
 *
 * @param time  the date/time (<code>null</code> not permitted).
 * @param zone  the time zone (<code>null</code> not permitted).
 */
public Week(final Date time, final TimeZone zone) {
    if (time == null) {
        throw new IllegalArgumentException("Null 'time' argument.");   
    }
    if (zone == null) {
        throw new IllegalArgumentException("Null 'zone' argument.");   
    }
    final Calendar calendar = Calendar.getInstance(zone);
    calendar.setTime(time);

    // sometimes the last few days of the year are considered to fall in the *first* week of
    // the following year.  Refer to the Javadocs for GregorianCalendar.
    final int tempWeek = calendar.get(Calendar.WEEK_OF_YEAR);
    if (tempWeek == 1 && calendar.get(Calendar.MONTH) == Calendar.DECEMBER) {
        this.week = 1;
        this.year =  new Year(calendar.get(Calendar.YEAR) + 1);
    }
    else {
        this.week = Math.min(tempWeek, LAST_WEEK_IN_YEAR);
        this.year = new Year(calendar.get(Calendar.YEAR));
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:30,代码来源:Week.java

示例12: parse

private static Date parse(String date, String yearStr, String monthStr, String dayStr) {
    int year;
    int month;
    int day;
    Calendar c = Calendar.getInstance();

    try {
        year = Integer.valueOf(yearStr);
        month = Integer.valueOf(monthStr);
        day = Integer.valueOf(dayStr);
    } catch (NumberFormatException e) {
        throw new IllegalArgumentException(date + " does not specify a valid date", e);
    }

    --month;

    if (BuildConfig.DEBUG && (year < 0
            || month < Calendar.JANUARY || month > Calendar.DECEMBER
            || day < 0 || day > 31)) {
        throw new AssertionError(date + " does not specify a valid date");
    }

    c.set(year, month, day);
    c.set(Calendar.MILLISECOND, 0);
    c.set(Calendar.SECOND, 0);
    c.set(Calendar.MINUTE, 0);
    c.set(Calendar.HOUR_OF_DAY, 0);

    return c.getTime();
}
 
开发者ID:mr-kojo,项目名称:Veggietizer,代码行数:30,代码来源:DateParser.java

示例13: getMonth

public static DataClass getMonth(LinkedList<DataClass> listParams) throws JFCALCExpErrException {
    if (listParams.size() != 1)   {
        throw new JFCALCExpErrException(ERRORTYPES.ERROR_INCORRECT_NUM_OF_PARAMETER);
    }
    DataClass datumTS = new DataClass();
    datumTS.copyTypeValueDeep(listParams.removeLast());
    datumTS.changeDataType(DATATYPES.DATUM_INTEGER);
    long lTS = datumTS.getDataValue().longValue();
    Calendar cal = Calendar.getInstance();
    cal.setTimeInMillis(lTS);
    int nReturn = cal.get(Calendar.MONTH);
    int nMonth = 1;
    switch (nReturn) {
        case (Calendar.JANUARY): {
            nMonth = 1;
            break;
        } case (Calendar.FEBRUARY): {
            nMonth = 2;
            break;
        } case (Calendar.MARCH): {
            nMonth = 3;
            break;
        } case (Calendar.APRIL): {
            nMonth = 4;
            break;
        } case (Calendar.MAY): {
            nMonth = 5;
            break;
        } case (Calendar.JUNE): {
            nMonth = 6;
            break;
        } case (Calendar.JULY): {
            nMonth = 7;
            break;
        } case (Calendar.AUGUST): {
            nMonth = 8;
            break;
        } case (Calendar.SEPTEMBER): {
            nMonth = 9;
            break;
        } case (Calendar.OCTOBER): {
            nMonth = 10;
            break;
        } case (Calendar.NOVEMBER): {
            nMonth = 11;
            break;
        } case (Calendar.DECEMBER): {
            nMonth = 12;
            break;
        }
    }
    return new DataClass(DATATYPES.DATUM_INTEGER, new MFPNumeric(nMonth));
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:53,代码来源:MFPDateTime.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.DECEMBER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。