1. show the first day of this month <br/> select dateadd (mm, datediff (mm, 0, getdate (), 0) <br/> select convert (datetime, convert (varchar (8), getdate (), <br/> 120) + '01', 120) </P> <p> 2. display the last day of the month <br/> select dateadd (day,-1, convert (datetime, convert <br/> (varchar (8), dateadd (month, 1, getdate (), 120) + '01', 120) <br/> select dateadd (MS,-3, dateadd (mm, datediff (M, 0, getdate () + 1, 0) </P> <p> 3. last day of last month <br/> select dateadd (MS,-3, dateadd (mm, datediff (Mm, 0, getdate (), 0) </P> <p> 4. the first Monday of this month I <br/> select dateadd (wk, datediff (wk, 0, dateadd (DD, 6-datepart (<br/> day, getdate ()), getdate (), 0) </P> <p> 5. the first day of this year <br/> select dateadd (YY, datediff (YY, 0, getdate (), 0) </P> <p> 6. last day of the year <br/> select dateadd (MS,-3, dateadd (YY, datediff (YY, 0, getdate () + )) </P> <p> 7. last day of last year <br/> select dateadd (MS,-3, dateadd (YY, datediff (YY, 0, getdate (), 0 )) </P> <p> 8. the first day of this quarter <br/> select Dateadd (QQ, datediff (QQ, 0, getdate (), 0) </P> <p> 9. monday of this week <br/> select dateadd (wk, datediff (wk, 0, getdate (), 0) </P> <p> 10. query records of this month <br/> select * From tablename where datepart (mm, thedate) <br/> = datepart (mm, getdate () and datepart (YY, thedate) <br/> = datepart (YY, getdate () </P> <p> 11. query records of this week <br/> select * From tablename where datepart (wk, thedate) = datepart <br/> (wk, getdate () and datepart (YY, thedate) = Datepart (YY, getdate () </P> <p> 12. query records of the current season. Note: getdate () is a function used to obtain the system time. <Br/> select * From tablename where datepart (QQ, thedate) = datepart <br/> (QQ, getdate () and datepart (YY, thedate) = datepart (YY, getdate () </P> <p> 13. obtain the total number of days of the current month: <br/> select datediff (DD, getdate (), dateadd <br/> (mm, 1, getdate ())) </P> <p> select datediff (day, <br/> dateadd (mm, datediff (mm, '', getdate ()),''), <br/> dateadd (mm, datediff (mm, '', getdate (), '2017-02-01 ') </P> <p> 14. obtain the current day of the week <br/> datename (weekday, getdate () </P> <p>