Adalarasan_Serangulam Adalarasan_Serangulam - 9 months ago 14
SQL Question

How to display the date as mm/dd/yyyy hh:mm Am/PM using sql server 2008 r2?

My sample query is


If somebody reading this question they are not trying to answer this. But they put the "down vote" for me as soon as possible. I want to share my doubts here. But i don't know why somebody behaving like this.

My given date format is like that
"2013-01-01 00:00:00.000".
I need to convert this date format to
"mm/dd/yyyy hh:mm AM/PM".
Do you have any idea about that ?
I searched all of the format, but all are not giving the output what i am expected. So i need to share this quetion to yours. Thanks in Advance.

Kaf Kaf

I think there is no single format to give them both. Try this using Convert; Sql-Demo

declare @mydate datetime = getdate()
select convert(varchar(10),@mydate, 101) + right(convert(varchar(32),@mydate,100),8)

|           COLUMN_0 |
| 02/22/2013  9:36AM |