1. Select getdate ()
Lili to the current time
2. Select convert (char, getdate (), 010) can get the current date.
The last parameter is used to determine the date format. The following is the format table.
Format: 000 output Date Format: SEP 14 200
Format type: 001 output Date Format: 09/14/01
Format type: 002 output Date Format: 01.09.14
Format type: 003 output Date Format: 14/09/01
Format type: 004 output Date Format: 14.09.01
Format type: 005 output Date Format: 14-09-01
Format type: 006 output Date Format: 14 Sep 01
Format type: 007 output Date Format: SEP 14, 01
Format type: 008 output Date Format: 17:06:08
Format type: 200 output Date Format: SEP 14
Format type: 010 output Date Format: 09-14-01
Format type: 011 output Date Format: 01/09/14
Format type: 012 output Date Format: 010914
Format: 013 output Date Format: 14 Sep 200
Format: 014 output Date Format: 17: 06: 08: 7
Format: 015 output Date Format: 17: 06: 08: 7
Format: 016 output Date Format: 17: 06: 08: 7
Format type: 017 output Date Format: 17: 06: 08: 7
Format: 018 output Date Format: 17: 06: 08: 7
Format: 019 output Date Format: 17: 06: 08: 7
Format: 020 output Date Format: 2001-09-14
Format type: 021 output Date Format: 2001-09-14
Format type: 022 output Date Format: 09/14/01
Format: 023 output Date Format: 2001-09-14
Format type: 024 output Date Format: 17:06:08
3. Select datediff (hour, '2017-12-8 21:41:42 ', getdate ())
Obtains the difference between the current time and the specified time.