Format Time in MS SQL Server 2012 Query

Hello. My environment is MS SQL Server 2012. I am trying to get my query to output the time in a readable format. Currently, it outputs the time in the below format. I would like to have it output into something like 11-01-2013 or 2013-11-01. Is this possible?

20131101140039.000000-420

Below is my query.
SELECT Time
from v_GS_DEPLOYMENT
LorrecAsked:
Who is Participating?
 
UnifiedISConnect With a Mentor Commented:
I don't think SQL will recognize that as a valid datetime.  Is it a string data type of some sort?

This assumes there will always be 4 digit year, 2 digit month, 2 digit day to start the string:
SELECT LEFT(Time, 4) + '-' + SUBSTRING(Time, 5,2) + '-' + SUBSTRING(Time, 7,2)
0
 
JimFiveCommented:
Maybe:
SELECT CONVERT(datetime, Time, 101)
0
 
LorrecAuthor Commented:
Thank you. This is what I needed.
0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
LorrecAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for Lorrec's comment #a39696713

for the following reason:

Thank you for the quick response.
0
 
JimFiveCommented:
Lorrec should accept the response that helped him.
0
 
UnifiedISCommented:
I agree with JimFive, it appears that one or both of our comments were helpful in resolving the problem.
0
 
LorrecAuthor Commented:
Thank you for the assistance.
0
All Courses

From novice to tech pro — start learning today.