Converting part of a string to a date

  • Hello everyone, I am very new to this forum but came across many good forum posts so I decided to join. My question is with regard to having an embedded date in a string and converting this to a date. I have a serial number like the following "GA0120100466" where the "GA" is not needed and really only the next six digits represent the date. So I can use the MID function and the LEFT function to extract "012010" without any trouble. Problem is I would like to convert this to a date so that I can calculate the age for example. So the date should be "01/20/10". Any help on this would be greatly appreciated. I also have some charting issues that I need to sort out at some point so if this is not the correct forum for inserting charts into SSRS reports let me know please.

    Paul

  • = FORMAT(DATESERIAL(LEFT(MID("GA0120100466",7),2),LEFT(MID("GA0120100466",3),2),LEFT(MID("GA0120100466",5),2)),"MM/dd/yy")

    - Susan

  • Susan, thank you for your help. Worked like a charm!

    Paul Bond

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply