Date format error - trying to set date/time from parsed text

I get the error:

Setting dataprovider with name ‘date_in’ / type ‘DATETIME’ with value of wrong type 2001-12-12 12:13:14

when I try to set a datetime field (MySQL backend) with a calculated string from a big text string I’m importing. I’ve tried different ways of calculating the input string, matching the format (or not) in the field in the form I’m bringing it into. As a varchar field, it works fine.
Eventually, I’m only interested in the time part of this field, which I’ve discovered how to display - but I would like to know how to get a string, which looks like a legit MySQL datetime into a datetime field.

tia,
Tom Langton

You can’t! A datetime field want to receive… a datetime value.

You need to convert the string to a datetime therefore.

Is “2001-12-12 12:13:14” a legit DATETIME value? (or am I missing something obvious?)

thanks for the quick response.

Tom Langton

Nope, that is a String value. You really need a datetime object: new Date()…