回答

2

唯一的办法是将一天中的时间存储为一个单独的属性。一个int将会很好,你可以将它存储为秒。你可以明确地做到这一点(即在设置日期时间的同时设置time属性,或使用computedproperty自动设置该值。

0

我有同样的问题(或多或少),我认为唯一的办法就是建立我们自己的日期类模型 事情是这样的:

class Date(ndb.model): 
    ... 
    day = ndb.IntegerProperty()  
    month = ndb.IntegerProperty() 
    year = ndb.IntegerProperty()    
    ... 

class Anything(ndb.Model): 
    ... 
    dateTime = ndb.StructuredProperty(Date) 
    ... 

相反的:

class Anything(ndb.Model): 
    ... 
    dateTime = ndb.DateTimeProperty() 
    ... 

而且我认为,我们应该有其他的方式来做到这一点更容易