Is 16167 and Epoch date format?
Is 16167 and Epoch date format?
declare @OracleDate as varchar(10) set @OracleDate = '16167' --[presume default settings for 2 digit years, meaning 49 is 2049, but 50 is 1950] --determine the start date of the year --and the number of days to add select cast('01-01-'+cast(left(@OracleDate,2)as varchar) as date), substring(@OracleDate,3, len(@OracleDate)) --put all together in a dateadd() function -- subtract one from the 'days to add' select dateadd( day, cast(substring(@OracleDate,3, len(@OracleDate)) as int)-1, cast('01-01-'+cast(left(@OracleDate,2)as varchar) as date) ) ---------- ---------- 2016-01-01 167 (1 row affected) ---------- 2016-06-15 (1 row affected)
23 People are following this question.