SQL queries today's records:
Datediff (day, [datetime], getdate () = 0 replace datetime with your corresponding field;
SQL query records of yesterday:
Datediff (day, [datetime], getdate () = 1 replace datetime with your corresponding field. getdate ()-datetime is the time difference.
This month's record:
Select * from table where datediff (month, [dateadd], getdate () = 0
Weekly record:
Select * from table where datediff (Week, [dateadd], getdate () = 0
Current day record:
Select * from table where datediff (day, [dateadd], getdate () = 0
| Function |
Parameters/functions |
| Getdate () |
Returns the current date and time of the system. |
| Datediff (interval, date1, date2) |
Returns the difference date2-date1 between date2 and date1 as specified by interval |
| Dateadd (interval, number, date) |
Add the date after number in the format specified by interval |
| Datepart (interval, date) |
Returns the integer corresponding to the specified part of interval in date. |
| Datename (interval, date) |
Returns the string name corresponding to the specified part of interval in date. |