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

how to convert the dateformat 2007-12-02 00:26:00  into mm/dd/yyyy i.e 12/02/2007 in T_sql?
mshanAsked:
Who is Participating?
 
BobTheViolentConnect With a Mentor Commented:
Perhaps this will help.

CONVERT (varchar(30), thedatestringhere, 101)

Open in new window

0
 
ZberteocConnect With a Mentor Commented:
If you have a date as string(text) and you want to change the format you have to cast the string to datetime first:

select
      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:

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

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.