Setting via Applescript the create date of an existing record

In Applescript I try to set the create date of an existing record. I use:

set creation date of theRecord to theCreationDate

with theCreationdate containing "2020-05-14T06:50:25Z".

However the date of the record doesn’t seem to update.

When I instead create a new record (via create record with {.... creation date:theCreationDate,...}) then it works!

Any idea how to fix this?

Is the class of theCreateDate a string (containing a formatted date) or a date? A date is required.

Aha! Thanks!

The date comes from the line

set theCreationDate to (value of XML attribute named "time" of theElement) as string

That’s the culprit. - Just strange that it works in the create record with construct…

So I guess I have to figure out how to convert in Applescript a "2020-05-14T06:50:25Z"-like string into a date class…