mysql如何判断字段时间小于当前时间3天

默认分类 未结 1 1447
_leeweidong_
_leeweidong_ 2023-11-27 09:24
相关标签:
1条回答
  • 2023-11-27 09:50

    用datediff函数:DATEDIFF(expr,expr2) 返回起始时间 expr和结束时间expr2之间的天数。Expr和expr2 为日期或 date-and-time 表达式。计算中只用到这些值的日期部分。例如你要查询字段时间小于当前时间3天的记录,可以这么写:select * from `tablename` where datetiff(now(), `datefield`)>3

    <%a=now()-3response.write a%>

    0 讨论(0)
提交回复