Get am/pm from datetime in sql queryHiren Soni14yPublished Aug 19, 2010, 12:00 AMUpdated May 24, 2012, 6:25 AM35.6k00Reactions×25BlogSELECT SUBSTRING(CONVERT(varchar(20), yourdate, 22), 18, 3) AS Expr1FROM tableORDER BY expr1 ;SUBSTRING(CONVERT(varchar(20), yourdate, 22), 18, 3)-->it gives you a am/pm.o/p:----ampmampmCommentsJoin the conversation! Your thoughts help the community grow.Sign in to leave a commentIt is the same account you read, post and publish with — and you will come straight back to this page.Sign inCreate an account
Join the conversation! Your thoughts help the community grow.