Garutyunyan
SSCrazy
Points: 2629
More actions
March 5, 2003 at 10:57 am
#80461
Does anyone know how to convert yyyyddd into mm/dd/yyyy? ie, '2003023' (01/23/2003).
Thank you
Antares686
SSC Guru
Points: 125444
March 5, 2003 at 11:18 am
#450333
Not sure of a better way but this example is how I do it.
declare @d char(7)
set @d = '2003123'
SELECT CAST(DATEADD(dd, CAST(RIGHT(@d,3) AS INT), '12/31/' + CAST((CAST(LEFT(@d,4) AS INT) - 1) AS CHAR(4))) AS DATETIME)
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply