2009-07-02 72 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"開始時加入