June 10, 2009 at 11:11 am
SELECT date_id
FROM Summary_D
Brings data in following format.
May 17 2009 12:00AM
May 18 2009 12:00AM
May 22 2009 12:00AM
May 26 2009 12:00AM
May 27 2009 12:00AM
Jun 1 2009 12:00AM
May 20 2009 12:00AM
May 23 2009 12:00AM
Jun 4 2009 12:00AM
Jun 5 2009 12:00AM
How do I convert to
6/4/2009
6/50/2009
etc.
June 10, 2009 at 11:22 am
Try this.
SELECT CONVERT(VARCHAR(10),CAST(date_id AS DATETIME),101)
FROM Summary_D
Also, what data type is date_id?
June 10, 2009 at 12:41 pm
Thanks - it works.
June 10, 2009 at 9:41 pm
abhavsar (6/10/2009)
SELECT date_idFROM Summary_D
Brings data in following format.
May 17 2009 12:00AM
May 18 2009 12:00AM
May 22 2009 12:00AM
May 26 2009 12:00AM
May 27 2009 12:00AM
Jun 1 2009 12:00AM
May 20 2009 12:00AM
May 23 2009 12:00AM
Jun 4 2009 12:00AM
Jun 5 2009 12:00AM
How do I convert to
6/4/2009
6/50/2009
etc.
Where will you be storing the dates once they're converted?
--Jeff Moden
Change is inevitable... Change for the better is not.
June 11, 2009 at 7:43 pm
Hi,
If you want to use DD/MM/YYYY style pattern then you need add the parameter style number 103.
Here is the example,
Declare @temp table
(
i datetime
)
Insert into @temp values ('2006-03-30 12:46:11.700')
select convert(varchar(10),i,103) from @temp
June 11, 2009 at 9:13 pm
I'd still like to know what the OP is going to do with the dates once they are converted.
--Jeff Moden
Change is inevitable... Change for the better is not.
June 11, 2009 at 11:45 pm
FYI - The query results are used by an external application.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply