周仙财

因为有做不完的梦, 所以一直在追求! 因为有走不完的路, 所以一直在尝试!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

 /// <summary>
        /// 计算当期日期是星期几
        /// </summary>
        /// <param name="y"></param>
        /// <param name="m"></param>
        /// <param name="d"></param>
        /// <returns></returns>
        private string CaculateWeekDay(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;
            string weekstr = "";
            switch (week)
            {
                case 0: weekstr = "Monday"; break;
                case 1: weekstr = "Tuesday"; break;
                case 2: weekstr = "Wednesday"; break;
                case 3: weekstr = "Thursday"; break;
                case 4: weekstr = "Friday"; break;
                case 5: weekstr = "Saturday"; break;
                case 6: weekstr = "Sunday"; break;

            }
            return weekstr;

        }
    }

posted on 2009-05-18 04:39  周仙财  阅读(326)  评论(0编辑  收藏  举报