sql time operation

SELECT the CONVERT (VARCHAR, GETDATE (), 120 ) // Current Time: 2019-07-26 08:58:09 
SELECT the CONVERT (VARCHAR ( 100 ), GETDATE (), 23 is ) // Current Time: 2019-07-26
SELECT * from Smoke WHERE DATEDIFF (day, DATEADD (dd, 0 , addTime), getdate ())> . 1 // current number of days between the time -addTime
SELECT getdate () - DATEADD (dd, 85 , AddTime) from BloodPatient / / current time - the current time plus 85 days
the SELECT DATEADD (MS, - . 3 , the DATEADD (mm, the DATEDIFF (mm, 0 , getdate ()), 0 )) // end of last month
the SELECT DATEADD (MS, - . 3 , the DATEADD (mm, the DATEDIFF (m, 0 , getdate ()) + . 1 , 0 )) // end of the month

 

Guess you like

Origin www.cnblogs.com/hyyweb/p/11248232.html