Re: How do you handle time zones?

From: Andrew Lindesay (ap..indesay.co.nz)
Date: Fri Oct 05 2007 - 15:27:56 EDT

  • Next message: Miguel Arroz: "Re: How do you handle time zones?"

    Hello Miguel;

    This is how I handle it --- Store a TZ in the session. I generally
    achieve this by having a attribute of the timezone against the user
    who logged in in the database. Next, create a formatter for date and
    timestamps in the session with accessors in the components'
    superclass. Every time you want to render a date/timestamp or have a
    date/timestamp entry field, use the formatters which are able to
    transform from GMT <---> Local Time. So your application data stays
    in GMT and is moved to and from the local time.

    You can see this pattern in my LEWOStuff framework;

            LEWOSimpleComponent.getFormatterForDateAndTimes()
            LEWOSimpleComponent.getFormatterForDates()

            LEWOSession.getTimeZone()
            LEWOSession.getFormatterForDateAndTimes()
            LEWOSession.getFormatterForDates()

    cheers.

    > As I live in a GMT country, I usually don't think much about this,
    > but now I need help! :)

    ___
    Andrew Lindesay
    technology : www.lindesay.co.nz
    business : www.silvereye.co.nz



    This archive was generated by hypermail 2.0.0 : Fri Oct 05 2007 - 15:29:31 EDT