Converting yyyymmdd to date

Converting from yyyymmdd to a standard date format uses a different set of Inspectors. First, break the string apart into day, month and year parts:

Q: first 2 of following text of position 6 of "20071201" as integer
A: 1
Q: first 2 of following text of position 4 of "20071201" as integer
A: 12
Q: first 4 of "20071201" as integer
A: 2007

Then convert these integers to their component date types:

Q: day_of_month (first 2 of following text of position 6 of "20071201") 
A: 1
I: day of month
Q: month (first 2 of following text of position 4 of "20071201" as integer)
A: December
I: month
Q: year (first 4 of "20071201" as integer)
A: 2007
I: year

These components are then concatenated to produce a standard date:

Q: day_of_month (first 2 of following text of position 6 of "20071201" as integer) 
& month (first 2 of following text of position 4 of "20071201" as integer) & year 
(first 4 of "20071201" as integer)
A: Sat, 01 Dec 2007
I: date

This can be simplified by using the ‘it’ keyword as a variable representing "20071201":

Q: (day_of_month (first 2 of following text of position 6 of it 
as integer) & month (first 2 of following text of position 4 of it 
as integer) & year (first 4 of it as integer)) of "20071201" 
A: Sat, 01 Dec 2007
I: date

A similar result can be accomplished by using a regular expression. The date can be extracted by choosing the first four digits:

Q: parenthesized part 1 of ( matches (regex "(\d\d\d\d)(\d\d)(\d\d)" ) 
of "20051201")
A: 2005

The various date segments can be assembled along these lines to create:

Q: (day_of_month (parenthesized part 3 of it as integer) & month (parenthesized 
part 2 of it as integer) & year (parenthesized part 1 of it as integer))of 
(matches (regex "(\d\d\d\d)(\d\d)(\d\d)") of "20051201")
A: Thu, 01 Dec 2005

As above, this expression uses the ‘day_of_month’ Inspector to return a date corresponding to the concatenation of the components.