As per question title, how to convert a Python string
to a Google App Engine db.TimeProperty
?
I tried to do:
obj.time = strptime("10:00", "%H:%M")
However I get the following error:
BadValueError: Property time must be a time, but was time.struct_time(tm_year=1900, tm_mon=1, tm_mday=1, tm_hour=10, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=1, tm_isdst=-1)
I'm not familiar with the (superseded)
db
docs, but from the NDB Cheat Sheetdb.TimeProperty()
corresponds directly tondb.TimeProperty()
. And fromndb
's Date and Time Properties:So I'd write it: