互联网解决方案咨询

梦想有多大路就会有多远:作一颗IT量子
  首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

中国生肖处理

Posted on 2008-04-05 19:55  互联网粒子  阅读(175)  评论(0编辑  收藏  举报
在开发网络社区中,有时会常用到生肖这个功能,以下是把一个人的出生年月转成对应的生肖功能
 /// <summary>
        /// Gets the name of the SNET member zodiac chinese.
        /// </summary>
        /// <param name="birthdayYear">The birthday year.</param>
        /// <returns></returns>
        public static string GetSNETMemberZodiacChineseName(DateTime birthdayYear)
        {
            int i = birthdayYear.Year%12;
            switch(i)
            {
                case  4:
                    return "鼠";
                    break;
                case 5:
                   return "牛";
                    break;
                case 6:
                    return "虎";
                    break;
                case 7:
                    return"兔";
                    break;
                case 8:
                   return"龙";
                    break;
                case 9:
                    return"蛇";
                    break;
                case 10:
                    return"马";
                    break;
                case 11:
                    return"11";
                    break;
                case 0:
                    return"猴";
                    break;
                case 1:
                    return"鸡";
                    break;
                case 2:
                    return"狗";
                    break;
                case 3:
                    return"猪";
                    break;
            }
            return "";
        }