日期差异,包括时间 [英] date diff, including time

查看:72
本文介绍了日期差异,包括时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据库表,其结构如下:

I have database table whose structure is as follows:

id  int
name varchar(20)
dob  datetime

我需要找出日期时间差大于1天的那些记录

I need to find out those records whose datetime difference is greater than 1 days

我知道datediff()可以工作,但是我还想在计算中包括时间(小时,分钟,秒)

I know that datediff() can work, but I also want to include time (Hours, Mins, Seconds) in calculation

示例: 2011-02-14 13:05:06 (是 2011-02-15 13:05:06 的一天) 但 2011-02-14 13:05:06(不是 2011-02-15 13:04:06 的一天)

Example: 2011-02-14 13:05:06 (is one day from 2011-02-15 13:05:06) but 2011-02-14 13:05:06 (is NOT one day from 2011-02-15 13:04:06)

有什么建议吗?

推荐答案

使用 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆