代码
/// <summary>
/// 判断是否已发布两小时,是否可以进行回复
/// </summary>
/// <param name="time">发布时间</param>
protected object CheckTime(object time)
{
DateTime create_time=Convert.ToDateTime(time.ToString());
DateTime now_time=DateTime.Now;
create_time=new DateTime(create_time.Year,create_time.Month,create_time.Day,create_time.Hour,create_time.Minute,create_time.Second);
now_time=new DateTime(now_time.Year,now_time.Month,now_time.Day,now_time.Hour,now_time.Minute,now_time.Second);
TimeSpan diff=now_time.Subtract(create_time);
if(diff.Days<=0&&diff.Hours<2)
{
msg="<script type='text/javascript'>var obj=document.getElementById('span_add_reply');obj.style.display='none';</script>";
}
return time;
}