NEWS

Tuesday, April 30, 2013

SQL SERVER – Get Time in AM/PM Format

Syntax to Get SQL DateTime With Am/Pm Format:


SELECT
GETDATE() AS CurrentDate,
RIGHT(CONVERT(VARCHAR, GETDATE(), 100),7) ASCurrentTime,
CONVERT(VARCHAR(10), GETDATE(), 101) + ' ' +RIGHT(CONVERT(VARCHAR, GETDATE(), 100),7) AS CurrentDateTime

8 comments: