0

I have a Date field in a table that is an int. The value looks like this: 20130618 I want to be able to convert that to an actual date like 06/18/2013 so I can do date calculations on it. How do I convert that field?

tsqln00b
  • 355
  • 1
  • 4
  • 20

1 Answers1

1
select convert(date, left(20130618, 8), 101)

or

select convert(date, cast(20130618 as char(8)), 101)
t-clausen.dk
  • 43,517
  • 12
  • 59
  • 92