Solved

datetime format

Posted on 2011-09-20
11
284 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:1jaws
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 36569902
If you want to see the date and time, then why use the CONVERT function at all?
0
 
LVL 18

Expert Comment

by:lludden
ID: 36569957
You can use CONVERT(varchar(20),DateSubmitted,0).  Look at the table in BOL to see what all the convert options do.
0
 

Author Comment

by:1jaws
ID: 36570337
I need to use such as 08/15/2011 on the date part.. shows me Aug 15 2011
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 18

Expert Comment

by:lludden
ID: 36570458
Then you need to combine two:

SELECT convert(varchar(8),DateSubmitted,101) + ' ' + convert(varchar(5),DateSubmitted,108)
0
 

Author Comment

by:1jaws
ID: 36570483
still not right... it shows me as 08/15/20
0
 
LVL 18

Assisted Solution

by:lludden
lludden earned 250 total points
ID: 36570514
Because I can't count.

SELECT convert(varchar(10),DateSubmitted,101) + ' ' + convert(varchar(5),DateSubmitted,108)
0
 

Author Comment

by:1jaws
ID: 36570529
still need a see AM, PM also :)
0
 
LVL 32

Accepted Solution

by:
Ephraim Wangoya earned 250 total points
ID: 36570728

select CONVERT(varchar(10), dateSubmitted, 101) + ' ' +
       RIGHT(CONVERT(varchar, dateSubmitted, 100), 8)
0
 

Author Comment

by:1jaws
ID: 36570741
thank you ewangoya! it works.. Ok, how should I give points now? :)
0
 
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 36570748

At your discretion, you can split or award all points according to the relevance and correctness of the solution
0
 

Author Closing Comment

by:1jaws
ID: 36570750
Thanks Guys!
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question