在自定义属性类型日期中插入带有cmis的“日期”

I have a custom type Clinical Record where some field is cli:date_created. The type of this property is Date.

When I try to set this field (with php) I get Argument of type "string" given but argument of type "\DateTime" was expected.". But I am giving a Date and not a string.

'cli:date_created' => date('d/m/Y',strtotime($resultado[0]['fecha_alta'])),

What do I have to do in order to insert a date? Because I don't want to change the type from date to string in this field.

Yes, you do give a string argument as the date function returns string.

Return Values ¶

Returns a formatted date string. If a non-numeric value is used for timestamp, FALSE is returned and an E_WARNING level error is emitted.

You need to pass a DateTime instance, e.g. using new \DateTime() constructor or another function that return a DateTime instance such as DateTime::createFromFormat

'cli:date_created' => DateTime::createFromFormat('[yourformat]', $resultado[0]['fecha_alta']),