0

I have this small query

SELECT 
    MAX(myDate) AS DateToUser
FROM 
    blaTable

I'm getting this result "2011-05-23 15:18:01.223"

how can I get the result like 05/23/2011 "mm/dd/yyyy" format?

3 Answers 3

1

Try this

FIDDLE DEMO

SELECT 
   convert(varchar,MAX(myDate),101) AS DateToUser
FROM blaTable

CONVERT

If you are using SQL SERVER 2012 then Simple use FORMAT

SELECT 
    FORMAT(MAX(myDate),'MM/dd/yyyy') AS DateToUser
FROM blaTable

FORMAT

Sign up to request clarification or add additional context in comments.

Comments

0
SELECT
    convert(varchar, MAX(myDate), 101) AS DateToUser
FROM 
    blaTable

For more Date Format Parameters: Click Here

Comments

0
SELECT 
    CONVERT(VARCHAR(20),MAX(myDate),101) AS DateToUser
FROM 
    blaTable

For more information on Sql server datetime formats have a look here

SQL SERVER FORMATS

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.