Friday, August 30, 2019

Check SQL Server system Date and Time


Using below commands you can check SQL server date and time.

Open query browser and type the following commands. And when you execute it output will come out.

Command : 1

Select CURRENT_TIMESTAMP;


Command : 2

Select SYSDATETIME();



In below Results column its show the current Date and Time.


Current TIME in Various Formats
Below are the examples of current TIME in various formats:

  1. Current TIME in the 24-hour format hh:mi:ss

SELECT CONVERT(VARCHAR(8), GETDATE(), 108) 'hh:mi:ss'


  1. Current TIME in the 24-hour format hh:mi:ss:mmm

SELECT CONVERT(VARCHAR(12),GETDATE(),114) 'hh:mi:ss:mmm'


  1. Current TIME in the 12-hour format hh:mi:ss:mmmAM

SELECT RIGHT(CONVERT(VARCHAR(26), GETDATE(), 109),14)
          'hh:mi:ss:mmmAM (or PM)'


No comments:

Post a Comment

Oracle Database 19c Installation on Oracle Linux 7

Pre-installation settings before installing Oracle Database 19c SELinux If the OS is to be used for an Oracle installation, it is ...