Hi I am not sure I see the need myself. I personally think you should store all dates as UTC and and normally perform calculations as UTC and then only on output apply the timezone.
Also you will probably find that the underlying mechanism is just storing a long, and so comparisons and sorts work effiiciently. Storing the timzone as well will mean extra extraneous data to be store (somewhere else). If you really want some different behaviour you will need to create an issue and hope enough people star it. I think you best approach for the moment, is store the timezone you want as another field. Then create a specific accessor method for getting the date/time in question with the timezone applied. Rgds T On Mar 24, 2:40 pm, Jairo Vasquez <[email protected]> wrote: > 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.
