Saturday, February 25, 2012

convert number to date datatype

easy question here.

I have:
0123
0125
0227
0327
04..
05..
06..
07..
08..
09..
..
1231

The first two numbers is the month and the second two numbers is the day of the month.

I need to display 01 as Jan, 02 as Feb and so on.

left(field1, 2) -- I know this grabs the first two numbers, but how do I convert it to a date data type?dateadd(dd,convert(int,right(field1,2)),dateadd(mm ,convert(int,left(field1,2)),'19000101'))

No comments:

Post a Comment