how to convert the dateformat 2007-12-02 00:26:00  into mm/dd/yyyy i.e 12/02/2007 in T_sql?

Posted on 2008-11-03
Medium Priority
Last Modified: 2009-10-12
how to convert the dateformat 2007-12-02 00:26:00  into mm/dd/yyyy i.e 12/02/2007 in T_sql?
Question by:mshan

Accepted Solution

BobTheViolent earned 1000 total points
ID: 22869060
Perhaps this will help.

CONVERT (varchar(30), thedatestringhere, 101)

Open in new window

LVL 27

Assisted Solution

Zberteoc earned 1000 total points
ID: 22869565
If you have a date as string(text) and you want to change the format you have to cast the string to datetime first:

      CONVERT (varchar(30), cast('2007-12-02 00:26:00' as datetime), 101) as date

If is a column that is of datetime type then simply:

      CONVERT (varchar(30), datecolumn, 101) as date


Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question