父の日や母の日などのフェスティバルは計算することも、会議の取り決めを促進するために毎月最高の金曜日として定義することもできます。
コードコピーは次のとおりです。
/**
*
* @param strdate
*開始日、フォーマットyyyy-mm-dd hh:mm:ss
* @Param CyclePriod
*間隔を繰り返します
* @param looppriod
*繰り返しタイプ、m =月、d = day、y = year、w = week、h = hour、f = minute、s = second
* MN =月のポジティブな日は何日ですか、MB = MB2が最後の2日目である場合、月の最終日は何日ですか
* W1..7 =毎週の日、MN1W2 =月の最初の週、MB2W4 =月の第2木曜日
* w後の値はマルチ値になる可能性があり、W135は1週目、3週目、金曜日を表します
* @Param Islunar
*それが月のカレンダーであるかどうかにかかわらず、渡された値は太陽カレンダーでなければなりません。また、戻ったグレゴリオカレンダーは、月のカレンダーによる計算後もまだ太陽カレンダーです。現在、月のカレンダーには、必要に応じて他の重複タイプが追加されています。
* @戻る
*/
翌回はpublic static string(string strdate、int cyclepriod、
string looppriod、boolean islunar){
string returnValue = "";
int [] dates = dateutils.gendate(strdate);
Chinesecalendar ccalendar = new Chinesecalendar();
ccalendar.setgregorianyear(日付[0]);
ccalendar.setGregorianMonth(日付[1]);
ccalendar.setgregoriandate(日付[2]);
if( "m" .equalsignorecase(looppriod))//月を処理します
{
if(islunar){
for(int i = 0; i <cyclepriod; i ++){
ccalendar.nextchinesemonth();
}
returnValue = dateutils.gendate(ccalendar.getGregorianyear()、
ccalendar.getGregorianMonth()、
ccalendar.getGregoriandate());
} それ以外 {
returnValue = dateutils.caldate(strdate、cycle -priod、2);
}
} else if( "d" .equalsignorecase(looppriod))//処理日
{
returnValue = dateutils.caldate(strdate、cycle -priod、5);
} else if( "y" .equalsignorecase(looppriod))//プロセス年
{
if(islunar){
ccalendar.addchineseyear(cyclePriod);
returnValue = dateutils.gendate(ccalendar.getGregorianyear()、
ccalendar.getGregorianMonth()、
ccalendar.getGregoriandate());
} それ以外 {
returnValue = dateutils.caldate(strdate、cycle -priod、1);
}
} else if( "w" .equalsignorecase(looppriod))//処理週
{
returnValue = dateutils.caldate(strdate、cycle -priod、3);
} else if( "h" .equalsignorecase(looppriod))//処理時間
{
returnValue = taTeutils.Addtime(strdate、0、cycle -priod);
} else if( "f" .equalsignorecase(looppriod))//処理分
{
returnValue = taTeutils.addtime(strdate、1、cycle -priod);
} else if( "s" .equalsignorecase(looppriod))//プロセス秒
{
returnValue = taTeutils.Addtime(strdate、2、cycle -priod);
} else //型破りなサイクルを処理します
{
if( "m" .equalsignorecase(stringutils.left(looppriod、1))){
string mnb = looppriod.substring(1、2);
文字列wnb = "";
int mnbvalue = 0;
int wnbvalue = 0;
if(looppriod.indexof( "w")> 1){
wnb = looppriod.substring(looppriod.indexof( "w") + 1、
looppriod.indexof( "w") + 2);
mnbvalue = integer.parseint(looppriod.substring(2、
looppriod.indexof( "w")));
wnbvalue = integer.parseint(looppriod.substring(
looppriod.indexof( "w") + 1、looppriod.length()));
if( "n" .equalsignorecase(mnb)){
returnValue = getBeeveweekday(strdate、mnbvalue、
wnbvalue);
} else if( "b" .equalsignorecase(mnb)){
returnValue = getBackWeekday(strdate、mnbvalue、
wnbvalue);
}
} それ以外 {
mnbvalue = integer.parseint(looppriod.substring(2、
looppriod.length()))-1;
if( "n" .equalsignorecase(mnb)){
returnValue = caldate(givemonthfirst(strdate)、
mnbvalue、5);
} else if( "b" .equalsignorecase(mnb)){
returnValue = caldate(givemonthlast(strdate)、
-mnbvalue、5);
}
}
} else if( "w" .equalsignorecase(stringutils.left(looppriod、1))){
string week = stringutils.right(looppriod、
looppriod.length() - 1);
strdate = caldate(strdate、cycle -priod -1、3);
while(true){
strdate = caldate(strdate、1、5);
if(week.indexof(string.valueof(getWeekday(strdate)))> = 0){
returnValue = strdate;
壊す;
}
}
}
}
ReturnValue;
}