TextToDate how to

I have a text column that contains the value ‘05122006’. How can I use this value to set a date column as ‘05/12/2006’?
In the Advanced Programming Guide I see the TextToDate example of:

//returns the DateObject as a date 03/11/1998
DateObject = new Date(03,11,98);

However, I have not been able to use this successfully to do the above.

What is your outcome?

I think the year should be formatted like yyyy and the month is a javascript month 11 = october…

If nothing works you can try the Tools plugin with the DateFormat function Servoy Components – Plugins, Beans, Web Components, Angular Services & Servoy Developer Consulting

datefield = new Date(03,11,98);
```returns '03-07-1904' to the datefield.

datefield = new Date(03,11,1998);

And what about ```
datefield = new Date(1998,11,03);

Yes, based on your above two suggestions the following appears to work:

var mytext = '05122006'
var mymonth = utils.stringLeft(mytext,2);
var myday = utils.stringMiddle(mytext,3,2);
var myyear = utils.stringMiddle(mytext,5,4);
datefield = new Date(myyear,mymonth-1,myday);

Thank you very much Marcel!

Dean