0
以下是從我的應用程序在GAE上覆制的相關代碼。gqlQuerry比較日期時間對象
today = datetime.datetime.strptime(date_variable, "%d/%m/%Y")
yesterday = ref_today - datetime.timedelta(days=1)
tomorrow = ref_today + datetime.timedelta(days=1)
logging.info('%s : %s : %s', yesterday, today, tomorrow)
#2016-02-19 00:00:00 : 2016-02-20 00:00:00 : 2016-02-21 00:00:00
records = db.GqlQuery("SELECT * FROM ProgrammeQueue"
" WHERE scheduledFrom < :1 AND scheduledFrom > :2 "
" ORDER BY scheduledFrom DESC",
tomorrow, yesterday)
問題陳述: 輸出:預計19/02/2016和20/02/2016 所有記錄:記錄=我在做什麼錯20/02/2016
所有記錄?
感謝格溫先生, –
計算代碼變更昨天=今天datetime.timedelta(微秒= 1)。有效。非常感謝您指出代碼中嚴重的邏輯錯誤。我的模型也保存着未來的數據。 –