判断是否是周六,周天

/// <summary>
/// 判断是否是周六,周天
/// </summary>
/// <param name="y"></param>
/// <param name="m"></param>
/// <param name="d"></param>
/// <returns></returns>
private static bool Whether_Weekend(int y, int m, int d)
{
if (m == 1 || m == 2)
{
m += 12;
y--;
}
int week = (d + 2 * m + 3 * (m + 1) / 5 + y + y / 4 - y / 100 + y / 400) % 7; // 基姆拉尔森公式
if (week == 5 || week == 6)
{
return true;
}
else
{
return false;
}
}

posted @ 2015-10-29 16:59  Coding_Yong  阅读(387)  评论(0编辑  收藏  举报