SQL SERVER – Get Time in AM/PM Format12/22/2008
Today i come with one situation where I need to get Time in AM/PM format.
I tried with different way and come up with the simple solution, that i am going to share with all of you.
GETDATE() AS CurrentDate,
RIGHT(CONVERT(VARCHAR, GETDATE(), 100),7) AS CurrentTime,
CONVERT(VARCHAR(10), GETDATE(), 101) + ‘ ‘ + RIGHT(CONVERT(VARCHAR, GETDATE(), 100),7) AS CurrentDateTime
I have read very interesting article on SQL Authority.Com . You can find the many ways to get date in different formats.