Solved

datetime format

Posted on 2011-09-20
11
287 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

623 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