SQL判断时间相等

  • Post author:
  • Post category:其他


datediff(day,time1,time2) =0

当time1 > time2 为负数;time1 < time2 为正数;

这种只会区别按天day的,对应的修改year,month,day,hour,second

sql转日期格式:

Select CONVERT(varchar(100), GETDATE(), 23): 2006-05-16

Select CONVERT(varchar(100), GETDATE(), 111): 2006/05/16

Select CONVERT(varchar(100), GETDATE(), 112): 20060516

Select CONVERT(varchar(100), GETDATE(), 120): 2006-05-16 10:57:49

Select CONVERT(varchar(100), GETDATE(), 8): 10:57:46

Select CONVERT(varchar(100), GETDATE(), 12): 060516

转载于:https://www.cnblogs.com/CurryZhang/p/7550678.html