Thanks,  but it still doesn't work. How do you convert the gae
timestamp?  It doesn't understand astimezone.

On Jan 25, 2:42 am, Alexander Kojevnikov <[email protected]>
wrote:
> Replace 'datetime_module' with 'datetime' everywhere and add this line
> on top of your Python file:
>
> import datetime
>
> On Jan 25, 12:18 pm, jones34 <[email protected]> wrote:
>
> > I'm trying to use timezones in my app. I understand the GAE decided
> > that this isn't something they really want to support well.  I'm
> > trying to use the workaround suggested of creating my own timezone
> > classes based on the  example code below from the GAE documentation.
> > It doesn't run. The exception I get is:
>
> > <type 'exceptions.NameError'>: name 'datetime_module' is not defined
>
> > Sorry I'm a python newbie, but what's missing?
>
> > --------------
>
> > class Pacific_tzinfo(datetime_module.tzinfo):
> >  """Implementation of the Pacific timezone."""
> >  def utcoffset(self, dt):
> >    return datetime_module.timedelta(hours=-8) + self.dst(dt)
>
> >  def _FirstSunday(self, dt):
> >    """First Sunday on or after dt."""
> >    return dt + datetime_module.timedelta(days=(6-dt.weekday()))
>
> >  def dst(self, dt):
> >    # 2 am on the second Sunday in March
> >    dst_start = self._FirstSunday(datetime_module.datetime(dt.year, 3,
> > 8, 2))
> >    # 1 am on the first Sunday in November
> >    dst_end = self._FirstSunday(datetime_module.datetime(dt.year, 11,
> > 1, 1))
>
> >    if dst_start <= dt.replace(tzinfo=None) < dst_end:
> >      return datetime_module.timedelta(hours=1)
> >    else:
> >      return datetime_module.timedelta(hours=0)
>
> >  def tzname(self, dt):
> >    if self.dst(dt) == datetime_module.timedelta(hours=0):
> >      return "PST"
> >    else:
> >      return "PDT"
>
> > pacific_time = utc_time.astimezone(Pacific_tzinfo())
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to