/// <summary> /// 生日转换成星座 /// </summary> /// <param name="birthday"></param> /// <returns></returns> public static string GetAstro(DateTime birthday) { string value = string.Empty; int month = birthday.Month; int day = birthday.Day; if (month == 1 && day >= 20 || month == 2 && day <= 18) { value = "水瓶座"; } if (month == 2 && day >= 19 || month == 3 && day <= 20) { value = "双鱼座"; } if (month == 3 && day >= 21 || month == 4 && day <= 19) { value = "白羊座"; } if (month == 4 && day >= 20 || month == 5 && day <= 20) { value = "金牛座"; } if (month == 5 && day >= 21 || month == 6 && day <= 21) { value = "双子座"; } if (month == 6 && day >= 22 || month == 7 && day <= 22) { value = "巨蟹座"; } if (month == 7 && day >= 23 || month == 8 && day <= 22) { value = "狮子座"; } if (month == 8 && day >= 23 || month == 9 && day <= 22) { value = "室女座"; } if (month == 9 && day >= 23 || month == 10 && day <= 22) { value = "天秤座"; } if (month == 10 && day >= 23 || month == 11 && day <= 21) { value = "天蝎座"; } if (month == 11 && day >= 22 || month == 12 && day <= 21) { value = "人马座"; } if (month == 12 && day >= 22 || month == 1 && day <= 19) { value = "摩羯座"; } return value; } |
转载于:https://www.cnblogs.com/deep-blue/p/5109965.html