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;

clip_image001

Command : 2

Select SYSDATETIME();

clip_image002

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’

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

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

clip_image004
  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)’

clip_image005
Click to rate this post!
[Total: 0 Average: 0]

Share and Enjoy !

Shares
Get Weekly KBV Tips !

Learn and improve day to day Knowledge & lifestyles.