-5

I want the date in MM/DD/YYYY format, currently when i put MODIFY_DATE as "DATE" it gives 2017-03-15 08:44:58.660 , I want to convert the date to MM/DD/YYYY.

James Z
  • 12,209
  • 10
  • 24
  • 44
Reddy
  • 1
  • 5
  • 4
    This post shows no real research or effort on your part. This is readily available on Google. – dfundako Apr 07 '17 at 13:03
  • 2
    [Sql server does not store date display format.](http://stackoverflow.com/questions/30032915/how-to-cast-the-datetime-to-time/30033028#30033028) – Zohar Peled Apr 07 '17 at 13:10
  • If you are using `SQL Server 2012`, you can use the `Format` function. – SS_DBA Apr 07 '17 at 13:36
  • I think you should first understand the difference between data storage and representation and then reformulate your question to make explicit what you actually need to know. – j4x Apr 07 '17 at 15:04

2 Answers2

0

Try with CONVERT, here you have definition and examples...

CONVERT(data_type(length),expression,style)

in style you need 101...

CONVERT(VARCHAR(10),<yourdatefieldHere>,101)

Hope this help!

M84
  • 727
  • 6
  • 14
  • I'm giving the below function but throwing an error, it says CAST or CONVERT: invalid attributes specified for type 'datetime' , MODIFY_DATE is the column name that gives the date and time and CTDATE is the alias. CONVERT(datetime(10),TEAR.MODIFY_DATE ,101) CTDATE – Reddy Apr 07 '17 at 13:58
  • replace "datetime(10)" to VARCHAR(10) – M84 Apr 07 '17 at 14:03
0

use below to convert the dates: select getdate(),CONVERT(VARCHAR(10),getdate(),101)