datetime format

convert(varchar, dateSubmitted, 110) as dateSubmitted just gives me date a 08/15/2011 format and I want to also see time beside the date how to do that.. tsql
1jawsAsked:
Who is Participating?
 
Ephraim WangoyaCommented:

select CONVERT(varchar(10), dateSubmitted, 101) + ' ' +
       RIGHT(CONVERT(varchar, dateSubmitted, 100), 8)
0
 
Patrick MatthewsCommented:
If you want to see the date and time, then why use the CONVERT function at all?
0
 
lluddenCommented:
You can use CONVERT(varchar(20),DateSubmitted,0).  Look at the table in BOL to see what all the convert options do.
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
1jawsAuthor Commented:
I need to use such as 08/15/2011 on the date part.. shows me Aug 15 2011
0
 
lluddenCommented:
Then you need to combine two:

SELECT convert(varchar(8),DateSubmitted,101) + ' ' + convert(varchar(5),DateSubmitted,108)
0
 
1jawsAuthor Commented:
still not right... it shows me as 08/15/20
0
 
lluddenCommented:
Because I can't count.

SELECT convert(varchar(10),DateSubmitted,101) + ' ' + convert(varchar(5),DateSubmitted,108)
0
 
1jawsAuthor Commented:
still need a see AM, PM also :)
0
 
1jawsAuthor Commented:
thank you ewangoya! it works.. Ok, how should I give points now? :)
0
 
Ephraim WangoyaCommented:

At your discretion, you can split or award all points according to the relevance and correctness of the solution
0
 
1jawsAuthor Commented:
Thanks Guys!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.