Home > database >  SQL server code
SQL server code

Time:09-16

Whether a day two time subtraction is less than 30 minutes

CodePudding user response:

Use datediff function judgment
 DATEDIFF (MINUTE, time1, time2) & lt; 30 

CodePudding user response:

If you are not sure which time in the former, which in time, will also have to add a ABS take absolute value:
 ABS (DATEDIFF (n, 'the 2020-04-19 03:20', '2020-04-19 02:30)) 
  • Related