//计算当前月份大1月1日有多少天
public static long getmonthDays(int year,int month)
{
long monthDays=0;
for(int i=1;i<month;i++)
{
switch(i)
{
case 4:
case 6:
case 9:
case 11:
monthDays+=30;break;
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
monthDays+=31;break;
case 2:
if(isRun(year)==true)
{
monthDays+=29;break;
}
else
{
monthDays+=28;break;
}
}
}
return (monthDays);
}
//得到润平年每月的天数,用于显示当月月历
public static int getTheMonthDays(int year,int month)
{
int TheMonthDays;
int []Pyuefen={31,28,31,30,31,30,31,31,30,31,30,31};
int []Ryuefen={31,29,31,30,31,30,31,31,30,31,30,31};
if(isRun(year))
{
TheMonthDays=Ryuefen[month-1];
}
else
{
TheMonthDays=Pyuefen[month-1];
}
return TheMonthDays;
}
//得到当前星期几
public static int getWeeks(int year,int month)
{
long Alldays=getmonthDays(year,month)+getyearDays(year);