本文整理汇总了Java中java.util.Calendar.APRIL属性的典型用法代码示例。如果您正苦于以下问题:Java Calendar.APRIL属性的具体用法?Java Calendar.APRIL怎么用?Java Calendar.APRIL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.util.Calendar
的用法示例。
在下文中一共展示了Calendar.APRIL属性的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");
}
}
示例2: LayerFancyLlama
public LayerFancyLlama(RenderLlama renderer)
{
this.renderer = renderer;
this.rand = new Random();
this.modelFancy = new ModelFancy();
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
isAFDay = calendar.get(Calendar.MONTH) == Calendar.APRIL && calendar.get(Calendar.DAY_OF_MONTH) == 1;
if(isAFDay)
{
modelRabbit = new ModelRabbit();
modelRabbit.isChild = false;
rabbitInstance = new EntityRabbit(null);
if(renderer.mainModel instanceof ModelLlama)
{
((ModelLlama)renderer.mainModel).head = new ModelRenderer(renderer.mainModel, 33, 4);
((ModelLlama)renderer.mainModel).head.addBox(-4.0F, -9.0F, -6.0F, 8, 11, 6, 0);
((ModelLlama)renderer.mainModel).head.setRotationPoint(0.0F, 7.0F, -6.0F);
}
}
}
示例3: 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");
}
}
示例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");
}
}
示例5: testBillingWithSteppedPricesForParameters
private void testBillingWithSteppedPricesForParameters(int paramValue,
BigDecimal expectedOverAllCosts,
BigDecimal expectedSteppedPricesAmount,
final BigDecimal[] stepAmountArray,
final BigDecimal[] stepEventCountArray, long paramModificationTime)
throws Exception {
final int testMonth = Calendar.APRIL;
final int testDay = 1;
final int testYear = 2010;
final long billingTime = getTimeInMillisForBilling(testYear, testMonth,
testDay);
long subscriptionCreationTime = getTimeInMillisForBilling(testYear,
testMonth - 2, testDay);
long subscriptionActivationTime = subscriptionCreationTime;
testBillingWithSteppedPricesForParameters(paramValue,
expectedOverAllCosts, expectedSteppedPricesAmount,
stepAmountArray, stepEventCountArray, 0, billingTime,
subscriptionCreationTime, subscriptionActivationTime,
paramModificationTime);
}
示例6: 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");
}
}
示例7: getLanguage
public static String getLanguage(final Context context) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
String lang = sp.getString(LANGUAGE_SELECTION, "et");
Calendar cal = Calendar.getInstance();
//noinspection WrongConstant
if (cal.get(Calendar.MONTH) == Calendar.APRIL && cal.get(Calendar.DAY_OF_MONTH) == 1) {
Log.d(TAG, "Activating April Fools Joke for app language!");
// APRIL FOOLS!
lang = "wo";
setLanguage(context, lang);
}
return lang;
}
示例8: getMonthTitle
@StringRes
public static int getMonthTitle(int num){
switch (num){
case Calendar.JANUARY:
return R.string.january;
case Calendar.FEBRUARY:
return R.string.february;
case Calendar.MARCH:
return R.string.march;
case Calendar.APRIL:
return R.string.april;
case Calendar.MAY:
return R.string.may;
case Calendar.JUNE:
return R.string.june;
case Calendar.JULY:
return R.string.july;
case Calendar.AUGUST:
return R.string.august;
case Calendar.SEPTEMBER:
return R.string.september;
case Calendar.OCTOBER:
return R.string.october;
case Calendar.NOVEMBER:
return R.string.november;
case Calendar.DECEMBER:
return R.string.december;
}
throw new IllegalArgumentException();
}
示例9: main
public static void main(String[] arg)
{
int result = 0;
Locale loc = new Locale("ko","KR");
Date now = new Date(108, Calendar.APRIL, 9);
DateFormat df =
DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.SHORT,loc);
SimpleDateFormat sdf = new SimpleDateFormat("",loc);
sdf.applyPattern("yyyy. M. d a h:mm");
if( !sdf.format(now).equals(df.format(now))){
result++;
System.out.println("error at " + sdf.format(now));
}
df = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM,loc);
sdf.applyPattern("yyyy'\ub144' M'\uc6d4' d'\uc77c' '('EE')' a h:mm:ss");
if( !sdf.format(now).equals(df.format(now))){
result++;
System.out.println("error at " + sdf.format(now));
}
df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG,loc);
sdf.applyPattern("yyyy. M. d a h'\uc2dc' mm'\ubd84' ss'\ucd08'");
if( !sdf.format(now).equals(df.format(now))){
result++;
System.out.println("error at " + sdf.format(now));
}
df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.FULL,loc);
sdf.applyPattern("yy. M. d a h'\uc2dc' mm'\ubd84' ss'\ucd08' z");
if( !sdf.format(now).equals(df.format(now))){
result++;
System.out.println("error at " + sdf.format(now));
}
if(result > 0) throw new RuntimeException();
}
示例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);
}
}
示例11: 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;
}
示例12: testBillingWithSteppedPricesForAll
/**
* Test for price model, events, priced parameter with stepped prices.
*
* @throws Exception
*/
@Test
public void testBillingWithSteppedPricesForAll() throws Exception {
final int testMonth = Calendar.APRIL;
final int testDay = 1;
final int testYear = 2010;
final long billingTime = getTimeInMillisForBilling(testYear, testMonth,
testDay);
long subscriptionCreationTime = getTimeInMillisForBilling(testYear,
testMonth - 2, testDay);
long subscriptionActivationTime = subscriptionCreationTime;
BigDecimal[] priceArray = { BD100, BD90, BD80 };
long[] freeAmountArray = { 0, 10, 20 };
BigDecimal[] additionalPriceArray = { BigDecimal.ZERO, BD1000,
BigDecimal.valueOf(1900) };
initData(billingTime, subscriptionCreationTime,
subscriptionActivationTime, limitArray, priceArray,
freeAmountArray, additionalPriceArray);
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
billingService.startBillingRun(billingTime);
return null;
}
});
Document doc = getBillingDocument();
String netCosts = XMLConverter.getNodeTextContentByXPath(doc,
"/BillingDetails/OverallCosts/@netAmount");
checkEquals("BugWrong net costs found", "230064.00", netCosts);
xmlValidator.validateBillingResultXML();
}
示例13: markEulaAccepted
public static void markEulaAccepted(final Context context) {
Log.d(TAG, "Marking EULA accepted.");
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
Calendar cal = Calendar.getInstance();
//noinspection WrongConstant
if (cal.get(Calendar.MONTH) == Calendar.APRIL && cal.get(Calendar.DAY_OF_MONTH) == 1) {
Log.d(TAG, "Accepting April Fools Joke for EULA!");
// APRIL FOOLS!
sp.edit().putBoolean(EULA_ACCEPTED + ".april" + cal.get(Calendar.YEAR), true).apply();
}
sp.edit().putBoolean(EULA_ACCEPTED, true).apply();
}
示例14: isEulaAccepted
public static boolean isEulaAccepted(final Context context) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
Calendar cal = Calendar.getInstance();
//noinspection WrongConstant
if (cal.get(Calendar.MONTH) == Calendar.APRIL && cal.get(Calendar.DAY_OF_MONTH) == 1) {
Log.d(TAG, "Activating April Fools Joke for EULA!");
// APRIL FOOLS!
return sp.getBoolean(EULA_ACCEPTED + ".april" + cal.get(Calendar.YEAR), false);
}
return sp.getBoolean(EULA_ACCEPTED, false);
}
示例15: testBillingWithRolesForUserAssignment
/**
* Billing test for price model with stepped price.
*
* @throws Exception
*/
private void testBillingWithRolesForUserAssignment(int numUser,
BigDecimal expectedPrice) throws Exception {
final int testMonth = Calendar.APRIL;
final int testDay = 1;
final int testYear = 2010;
final long billingTime = getTimeInMillisForBilling(testYear, testMonth,
testDay);
long subscriptionCreationTime = getTimeInMillisForBilling(testYear,
testMonth - 2, testDay);
long subscriptionActivationTime = getTimeInMillisForBilling(testYear,
testMonth - 2, testDay);
int userNumber = numUser;
initDataPriceModel(userNumber, subscriptionCreationTime,
subscriptionActivationTime);
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
billingService.startBillingRun(billingTime);
return null;
}
});
Document doc = getBillingDocument();
String costs = XMLConverter.getNodeTextContentByXPath(doc,
"/BillingDetails/OverallCosts/@grossAmount");
checkEquals(expectedPrice.toPlainString(), costs);
}