DateTime now = DateTime.Now; DateTime ti = DateTime.Now; //天数 int dates=(now - ti).Days;
select DATEDIFF(DD,'2022-05-22','2022-06-01')
如此便可获得天数