计算时间天数:
public static long getDu(string strateTime,string endTime)
{
long dutant=0;
try
{
string framt = "yyy-mm-dd";
long puls = 60 * 60 * 24;
if (endTime.Length!=strateTime.Length)
{
string mes = "时间错";
} if (endTime.Length==13)
{
framt = "yyy-mm-dd hh";
puls = 60 * 60 ;
}
else if (endTime.Length==7)
{
framt = "yyy-mm";
puls = 30 * 24 * 24 * 60;
}
string.Format(framt);
DateTime dt1 =DateTime .Parse( endTime);
DateTime dt2 = DateTime.Parse(strateTime); ;
dutant=(dt1-dt2)/1000+puls
}
catch (Exception)
{
throw;
}
return dutant;
}
计算天数
最新推荐文章于 2022-12-23 15:59:51 发布