zoukankan      html  css  js  c++  java
  • ASP.NET根据日期获取星座方法!

        /// <summary>返回星座
        
    /// 
        
    /// </summary>
        
    /// <param name="date">日期</param>
        
    /// <returns></returns>
        public static string GetXinZuo(string date)
        {
            DateTime d;
            
    if (DateTime.TryParse(date, out d))
            {
                d 
    = DateTime.Parse(d.Month + "-" + d.Day);
                
    if (d >= DateTime.Parse("03-21"&& d <= DateTime.Parse("04-19"))
                {
                    
    return "白羊座";
                }
                
    else if (d >= DateTime.Parse("04-20"&& d <= DateTime.Parse("05-20"))
                {
                    
    return "金牛座";
                }
                
    else if (d >= DateTime.Parse("05-21"&& d <= DateTime.Parse("06-21"))
                {
                    
    return "双子座";
                }
                
    else if (d >= DateTime.Parse("06-22"&& d <= DateTime.Parse("07-22"))
                {
                    
    return "巨蟹座";
                }
                
    else if (d >= DateTime.Parse("07-23"&& d <= DateTime.Parse("08-22"))
                {
                    
    return "狮子座";
                }
                
    else if (d >= DateTime.Parse("08-23"&& d <= DateTime.Parse("09-22"))
                {
                    
    return "处女座";
                }
                
    else if (d >= DateTime.Parse("09-23"&& d <= DateTime.Parse("10-23"))
                {
                    
    return "天秤座";
                }
                
    else if (d >= DateTime.Parse("10-24"&& d <= DateTime.Parse("11-22"))
                {
                    
    return "天蝎座";
                }
                
    else if (d >= DateTime.Parse("11-23"&& d <= DateTime.Parse("12-21"))
                {
                    
    return "射手座";
                }
                
    else if ((d >= DateTime.Parse("12-22"&& d <= DateTime.Parse("12-31")) ||
                    (d 
    >= DateTime.Parse("01-01"&& d <= DateTime.Parse("01-19")))
                {
                    
    return "摩羯座";
                }
                
    else if (d >= DateTime.Parse("01-20"&& d <= DateTime.Parse("02-18"))
                {
                    
    return "水瓶座";
                }
                
    else if (d >= DateTime.Parse("02-19"&& d <= DateTime.Parse("03-20"))
                {
                    
    return "双鱼座";
                }
                
    else
                {
                    
    return "未知日期";
                }
            }
            
    else
            {
                
    return "日期格式错误";
            }
        }
    撸码:复制、粘贴,拿起键盘就是“干”!!!
  • 相关阅读:
    如何避免延迟发货和虚假发货
    买家一个单下了两件,我想发两个包裹怎么办
    我有多个店铺,怎么方便的打单?
    一个人在我店里下了几个单,可以合起来发一个包裹吗
    疫情风险高的地方快递都不发,我怎么把这些地区的订单排除掉?
    拼多多商家发货后,可以实时提醒哪些物流快超时了吗
    史上最通俗易懂的手写人工神经网络——(一)(转载自https://blog.csdn.net/xipengbozai/article/details/118115444)
    炸天的3D引擎OpenCASCADE的用法及案例(https://blog.csdn.net/xipengbozai/article/details/117044032?spm=1001.2014.3001.5502)
    屌炸天的3D引擎OpenCASCADE的用法及案例(转载之处:)
    JS实现环绕地球飞行的3D飞行线动画效果(JS+HTML)
  • 原文地址:https://www.cnblogs.com/niunan/p/1555002.html
Copyright © 2011-2022 走看看