0
$\begingroup$

I'm trying to add a datetime as property to an object like so:

from datetime import datetime
obj = bpy.context.active_object
obj['somedate'] = datetime.strptime('1900-01-01', '%Y-%m-%d')

...and get an runtime TypError about datetime.datetime not being supported as id-property.

Is there a simple way to add this support? (...or is it easier to work with string properties and convert as needed with strptime/strftime?)

$\endgroup$
1
$\begingroup$
import bpy

from datetime import datetime
obj = bpy.context.active_object
obj['somedate'] = str(datetime.strptime('1900-01-01', '%Y-%m-%d'))
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.