Declare @TestDate DateTime
Set @TestDate = '23:59'
Select Convert(VarChar(10),
Case When (datepart(hour, @TestDate) % 12) = 0
Then 12
Else DatePart(hour, @TestDate) % 12
End
)
+ Case When DatePart(hour, @TestDate) < 12
Then ' AM'
Else ' PM'
End
-George
Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.