2009-07-02 35 views
0

3.当我正在执行以下语句时,为什么在数据存储区的startime字段中添加了“jan 1st 1970”?在后台添加日期,同时在数据存储中添加时间GAE

(hour,min) = self.request.get('starttime').split(":") 
    #if either of them is null or empty string then int will throw exception 
    if hour and min : 
     datastoremodel.starttime = datetime.time(int(hour), int(min)) 

虽然当我检索它只有时间来通过?我想知道在数据存储中做什么日期?任何线索?

+0

是什么类型是db.Model – 2009-07-02 07:51:07

+0

的类型,以便其可接受的行为谷歌和应用程序,thx太多 – dhaval 2009-07-02 08:13:58

回答

2

谷歌应用程序引擎doc

class TimeProperty(verbose_name=None, auto_now=False, auto_now_add=False, ...) 
A time property, without a date. Takes a Python standard library datetime.time value. See DateTimeProperty for more information. 
Value type: datetime.time. This is converted to a datetime.datetime internally. 

所以时间转换为日期,epoch time "jan 1st 1970"开始时加入