Thank you kindly Massimo.

I am storing the data in OrientDB so will be unable to test the time
shift field representation boooo it looks so clean and simple.

However I think I can store everything as UTC with your first tip and
use JS to detect the user's timezone and convert the UTC to local in
JS returned in a view.

Is that correct?

-David



On Oct 4, 11:36 pm, Massimo Di Pierro <[email protected]>
wrote:
> request.now = request.utcnow
>
> on top of db.py will make sure internally you have request.utcnow
> everwhere.
>
> Then you can set
>
> shift=datetime.timedelta(....)
> db.table.field.represent = lambda d,r,s=shift: prettydate(d+s)
>
> for all tables and fields where shift is the localtion-uct time shift.
> To compute it you need to know where the visitor it.
>
> On Oct 4, 6:39 pm, TheSweetlink <[email protected]> wrote:
>
> > I want to insert all posts in UTC and convert to local time with
> > prettydates.
>
> > Either the gluon.tools prettydate() or a JS script I got a hold of
> > convert the time properly.
>
> > How could I insert a record that is UTC timestamped in the db but
> > converted to local timezone when retrieving and viewing the record?
>
> > Thanks in advance.
>
> > -David
>
>

Reply via email to