Thanks Tim,

But I would like to see a more clean definition like an additional
flag in the class definition like "auto_now" or "auto_now_add" that
clearly defines the behavior of the object.

Best Regards,

On Mar 10, 10:21 am, Tim Hoffman <[email protected]> wrote:
> Hi
>
> it appears that the DateTimeProperty converts to UTC if a timezone is
> defined and stored, and you get a naive datetime back from the
> datastore, (which has no timezone attached).
> Also auto_now etc... creates dates as utc
>
> you can get the date back in whatever timezone you want by re-adding
> the utc timezone definition, then getting a new date with whatever
> timezone you are in.
>
> from pytz import timezone
>
> mytz = timezone('Australia/West')
> utc = timezone('UTC')
>
> utc_date = obj.mydate.replace(tzinfo=utc)
> mydate = utc_date.astimezone(tz)
>
> T
>
> On Mar 10, 9:52 pm, Jairo Vasquez Moreno <[email protected]>
> wrote:
>
>
>
> > Hi,
>
> > Is there a clean way (without having to change TZ environment
> > variable) to set the timezone of a property using auto_now so eveytime
> > my entity is updated time is in the timezone I need.
>
> > Thanks in advance
>
> > --
> > Jairo Vasquez Moreno
> > Mentez Developerwww.mentez.com
> > Medellin - Colombia

-- 
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