convert datetime

CONVERT(DATETIME, CONVERT(VARCHAR(10), GETDATE(),120), 120)

I am using the above to only get the date and exclude the time.  

I get Jul  7 200

Is there a way that I can get 07/07/2006 instead?

I got this convertion from another question that I asked and just cut and paste, but can anyone walk me through with what its doing?  

thanks!!
yanci1179Asked:
Who is Participating?
 
william007Connect With a Mentor Commented:
Try this
select CONVERT(VARCHAR(10), GETDATE(),101)
It convert the date the varchar in mm/dd/yyyy format.
0
 
ibostConnect With a Mentor Commented:
if you just want to drop the time portion of the date and then return a datetime datatype, you could use this:

cast(datediff(day, 0, getdate()) as datetime)
0
 
Aneesh RetnakaranConnect With a Mentor Database AdministratorCommented:
Hi yanci1179,

ALSO

select CONVERT(VARCHAR(10), GETDATE(),101)  -- mm/dd/yyyy
select CONVERT(VARCHAR(10), GETDATE(),103) --dd/mm/yyyy


refer BOOKS online for 'Convert'

Aneesh R!
0
 
yanci1179Author Commented:
thanks
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.