Solved

Have time show with the date in SQL Server

Posted on 2012-04-02
2
288 Views
Last Modified: 2012-06-27
I have the following code which shows date... Ex:(02/06/2012)
convert(varchar, CAST(TS_Day2 as datetime),101) as Expected,

I also have code that shows the date and time... Ex:(Feb 6 2012 7:15AM)
CONVERT(varchar(20), CAST(a.Expected AS datetime), 100) as Expected,

What code do I use if I want... 01/06/2012 7:15AM?
I don't want Jan, Feb, I want 01 and 02.
0
Comment
Question by:BobRosas
[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
2 Comments
 
LVL 21

Accepted Solution

by:
JestersGrind earned 150 total points
ID: 37797476
You could do something like this.

SELECT CONVERT(VARCHAR, CAST(TS_Day2 AS DATETIME),101) + SUBSTRING(CONVERT(VARCHAR, CAST(TS_Day2 AS DATETIME),100), 12, 10) AS Expected

Open in new window


Greg
0
 

Author Closing Comment

by:BobRosas
ID: 37797523
Worked great!  Thank you so much!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

A recent question popped up and the discussion heated up regarding updating a COMMENTS (TXT) field in a table using SSRS. http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Q_27475269.html?cid=1572#a37227028 (htt…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

734 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