The datediff function returns the interval between two dates. Format:
Datediff (interval, date1, date2 [, firstdayofweek [, firstweekofyear])
Parameters
Interval
Required. String expression indicates the time interval between date1 and date2. Date1, date2
Required. Date expression. Two dates used for calculation.
Firstdayofweek
Optional. Specify the constant of the first day of the week. If not specified, the default value is Sunday. For values, see the "Settings" section.
Firstweekofyear
Optional. Specifies the constant of the first week of a year. If this parameter is not specified, the default value is the week of April 1, January 1. For values, see the "Settings" section.
Yyyy
Q quarter
N months
Y number of days in a year
D
Number of days per week
WW week
H hour
M minutes
S seconds
Example: Find all records added to the table today
Select
From
Inout_public_oldsterrecord
Where
Datediff ("D", createdatetime_dat, getdate () = 0