namespace dapperTest
{
    public class Program
    {
        static void Main(string[] args)
        {

            
            DateTime dt3 = DateTime.Parse("2020-08-09");
            //DateTime dt4 =DateTime.Parse(dt3.ToString("mm-dd"));

            Console.WriteLine(IsInDate(dt3));
            Console.ReadLine();


        }
        /// <summary> 
        /// 判断某个日期是否在某段日期范围内,返回布尔值
        /// </summary> 
        /// <param name="dt">要判断的日期</param> 
        /// <param name="dt1">开始日期</param> 
        /// <param name="dt2">结束日期</param> 
        /// <returns></returns>  
        private static bool IsInDate(DateTime dt)
        {
            return dt.CompareTo(DateTime.Parse("03-03")) >= 0 && dt.CompareTo(DateTime.Parse("08-08")) < 0;
        }
    }
}

您必须 登录 才能发表评论