I'm running App Engine with Django. I'm having troubles executing
timezone conversion via pytz. I have looked at the Google example
implementation. The following works in IDLE:

>>> import pytz
>>> from pytz import common_timezones
>>> from pytz import timezone
>>> import datetime
>>> timestamp = datetime.datetime.utcnow()
>>> print timestamp
2009-03-22 11:02:41.578000
>>> translated = 
>>> timestamp.replace(tzinfo=pytz.utc).astimezone(timezone('US/Central'))
>>> print translated
2009-03-22 06:02:41.578000-05:00

I have tried to run the following in my app (modules imported, too):

def tz(request):
    timestamp = datetime.datetime.utcnow()
    translated = timestamp.replace(tzinfo=pytz.utc).astimezone(timezone
('US/Central'))
    return respond(request, user, 'tz',
{'translated':translated,'timestamp':timestamp})

When I pull up the page, I get the following error:
UnknownTimeZoneError at /tz
'US/Central'
Request Method:         GET
Request URL:    http://localhost:8080/tz
Exception Type:         UnknownTimeZoneError
Exception Value:        'US/Central'

Does this not work in App Engine for some reason?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to