Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 date fomat

Author  Topic 

jung1975
Aged Yak Warrior

503 Posts

Posted - 2004-06-23 : 17:57:01
How to change the format of date:
,for example, from yyyy-mm-dd to mm-dd-yy

thanks
jung



tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-06-23 : 17:58:41
You'll need to use CONVERT with a style. Dates aren't actually stored in that format, they just have a default display. For mm-dd-yy, use style 10:

SELECT CONVERT(VARCHAR(50), GETDATE(), 110) -- for yyyy
or
SELECT CONVERT(VARCHAR(50), GETDATE(), 10) -- for yy

Tara
Go to Top of Page

Pat Phelan
Posting Yak Master

187 Posts

Posted - 2004-06-23 : 17:59:23
Use the Convert function with the appropriate format argument.

-PatP
Go to Top of Page

Pat Phelan
Posting Yak Master

187 Posts

Posted - 2004-06-23 : 18:00:44
Man, you've got fast fingers there, lady!

-PatP
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-06-23 : 18:01:35


Tara
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-06-23 : 18:37:26
do this at the client, it is a display issue.

- Jeff
Go to Top of Page
   

- Advertisement -