Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 date conversion

Author  Topic 

Asteroid
Starting Member

13 Posts

Posted - 2005-07-02 : 11:22:04
Hi,
I have date in char format which i have inported from a txt file.
The format is like this

20050612 ----------> data type char
YYYYMMDD
and i want it to display it in date like format as 12-05-2005.

Any help

JBelthoff
Posting Yak Master

173 Posts

Posted - 2005-07-02 : 12:48:04
Try
convert(datetime, '20050612')


JB
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-07-04 : 01:49:54
Do this in your presentation layer

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-07-04 : 03:32:47
DECLARE @MyDate datetime
SET DATEFORMAT YMD
SELECT @MyDate = '20050612'
SELECT @MyDate = DATEADD(Month, -1, @MyDate) --
SELECT CONVERT(varchar(11), @MyDate, 105)

Kristen
Go to Top of Page
   

- Advertisement -