
if datediff("d",date1,date2)>0 then
这里,第一个参数是比较的类型,d是天,m是月,y是年,更多类型自己去百度。
date1,date2是两个要比较的时间。
如 datediff("d",#2012-08-03#,#2012-08-03 14:09#)
这个结果就是等于0的,因为不够一天。
mysql中获取系统时间的方法:mysql>select now()
mysql>select sysdate()
mysql>select curdate()
mysql> select current_date
mysql> select curtime()
mysql>select current_time
假设要比较的两个日期 分别为 rq1,rq2则比较:
select case when rq1-rq2>=0 then '该日期rq2小于等于日期rq1' else '该日期rq2大于于等于日期rq1' end
与系统日期比较:
select case when GETDATE ()-rq1>=0 then '该日期rq1小于等于当前系统日期' else '该日期rq1大于等于当前系统日期' end
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)