I'm newbie.
I have a question about DateTimeProperty. I saw "Date-time values are
stored as and returned using the UTC time zone." in below link:
http://code.google.com/appengine/docs/datastore/typesandpropertyclasses.html#DateTimeProperty
Then I saw another sample to convert timezone by "astimezone(tz)":
http://code.google.com/appengine/docs/datastore/typesandpropertyclasses.html#datetime
The only difference to me is I use pytz to create tzinfo, below is my
source code:
......
import pytz
from pytz import timezone
......
taipei_tz = timezone('Asia/Taipei')
......
......
for greeting in greetings:
......
#greeting.date.replace(tzinfo=taipei_tz)
greeting.date.astimezone(taipei_tz)
self.response.out.write("<td>")
self.response.out.write(greeting.date.tzname())
self.response.out.write("</td>")
......
But I get these error message:
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\ext
\webapp\__init__.py", line 499, in __call__
handler.get(*groups)
File "C:\GoogleAppEngineWorkspace\helloworld\05_helloworld_db.py",
line 51, in get
greeting.date.astimezone(taipei_tz)
ValueError: astimezone() cannot be applied to a naive datetime
So, the date field got from datastore is a naive datetime? then I
can't use "astimezone()" on that?