今天的所有数据:select * from 表名 where DateDiff(dd,datetime类型字段,getdate())=0昨天的所有数据:select * from 表名 where DateDiff(dd,datetime类型字段,getdate())=17天内的所有数据:select * from 表名 where DateDiff(dd,datetime类型字段,getdate())<=730天内的所有数据:select * from 表名 where DateDiff(dd
import java.util.Calendar; public class Main { public static void main(String[] args) { Calendar cal = Calendar.getInstance(); int day = cal.get(Calendar.DATE); int month = cal.get(Calendar.MONTH) + 1; int year = cal.get(Calendar.YEAR); int dow = cal
--查询当天: select * from info where DateDiff(dd,datetime,getdate())=0 --查询24小时内的: select * from info where DateDiff(hh,datetime,getDate())<=24 --本月记录 SELECT * FROM 表 WHERE datediff(month,[dateadd],getdate())=0 --本周记录 SELECT * FROM 表 WHERE
select GETDATE() as '当前日期',DateName(year,GetDate()) as '年',DateName(month,GetDate()) as '月',DateName(day,GetDate()) as '日',DateName(dw,GetDate()) as '星期',DateName(week,GetDate()) as '周数',DateName(hour,GetDate()) as '时',DateName(minute,GetDate()) as '