a fundamental question on system date
Please forgive my naivette...a very fundamental question:
I have a google app engine project that has a cron job that fetches records with date matching the current system date. This cron job triggers at 0:00 (ie, 12:00AM 开发者_运维百科midnight) everyday. The cron job is apparently fetching records corresponding to the previous day. What could be wrong?
Has it got anything to do with the delay involved with updation of system date at 0:00? I was assuming that cal to get system date at 12:00AM would give the new day's date. Am I wrong?
Time zones... the system may be working in UTC or, at least, something other than the time zone you expect.
You should configure your cron.yaml
file like this:
- description: midnight task
url: /path/to/task
schedule: every day 00:00
timezone: Asia/Kolkata
See the docs.
The problem is that date-time values are stored as and returned using the UTC time zone and that can't be changed. You should treat this when updating your records. More info available here and here.
精彩评论