首页 > 开发 > 综合 > 正文

在sql的条件里进行日期添加或减去一个值(年月日的一个值)

2024-07-21 02:45:20
字体:
来源:转载
供稿:网友
DATEADD(day,-6,Duetime) <= GETDATE()

 

  //在DataView中排序
            strSql += strWhere + "  ";

            strSql += " and Pmn_ExecutePlanDate>getdate()";
  
            strSql += " and getdate()< DATEADD(dd,-Pmn_PReTimeSpan,Pmn_ExecutePlanDate)";
            //条件判断
DATEDIFF(datepart,   startdate,   enddate)


一下是diff的参数
Datepart   Abbreviations  
year   yy,   yyyy  
quarter   QQ,   q  
month   mm,   m  
dayofyear   dy,   y  
day   dd,   d  
week   wk,   ww  
hour   hh  
minute   mi,   n  
second   ss,   s  
millisecond   ms  


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表