Click here to Skip to main content
14,919,811 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Convert datetime(6/25/2014 12:00:00 AM) format to date(yyyy-MM-dd) format in SQL server 2008 ....Please help me
Posted
Updated 3-Jul-14 0:38am
v2
Comments
CHill60 3-Jul-14 6:41am
   
You have also tagged asp.net and c# ... dates don't have "format" in databases but you can change the way they are displayed - if you are displaying the date in asp.net do you want the formatting for that instead? Post the code you are using to display the date

Hi,
you can try-
SQL
SELECT CONVERT(CHAR(10), convert(DATE, '6/25/2014 12:00:00 AM'), 126)
   
v2
SELECT CONVERT(char(10), GetDate(),126)


follow this link

http://www.sql-server-helper.com/tips/date-formats.aspx[^]
   
v2
Hi,

You can use below line for converting

SQL
CONVERT(varchar(10),GETDATE(),126)
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900