Solved

Have time show with the date in SQL Server

Posted on 2012-04-02
2
282 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
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Introduction Earlier I wrote an article about the new lookup functions (http://www.experts-exchange.com/A_3433.html) that ship with SQL Server 2008 R2.  In this article I’m going to show you another new feature of SSRS 2008 R2, this time in the vis…
In this article I will describe the Backup & Restore 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.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

864 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now