I have a column that I need to get into mm/dd/yyyy format I can get it that way as a varchar but converting to a date gives me a problem. I thought it was my data but look at this example,
select Convert(varchar,getdate(), 101) as date1,
CONVERT(datetime, CONVERT(varchar(8), GETDATE(), 101)) as date2
from test_table
date1 returns 12/20/2005
date2 returns 2005-12-20 00:00:00.000
I've tried lots of variations; every one I can think of without success.
How is this possible? How do I get the right format?
Thanks in advance for anything anyone can add.
select Convert(varchar,getdate(), 101) as date1,
CONVERT(datetime, CONVERT(varchar(8), GETDATE(), 101)) as date2
from test_table
date1 returns 12/20/2005
date2 returns 2005-12-20 00:00:00.000
I've tried lots of variations; every one I can think of without success.
How is this possible? How do I get the right format?
Thanks in advance for anything anyone can add.