Hi, My project is using O-R mapping tool Datanucleus(JDO) to manipulate database so we can easily change database.For client-server version our database is Postgresql and in single user version we choose H2.Conversion to H2 is smooth and H2 works great only that Datanuclues default maps java Date to timestamp with time zone for Postgresql,but mapped to timestamp for H2.Since data was generated from all the worlds.We are worried that the lost timezone in H2 will got problem on data replication some other day.
So has H2 got any plan to support timestamp with time zone? Currently what we do is to change all TIMESTAMP data type to long for both Postgresql and H2.So we might get better portability. Regards, Ray On 10月8日, 上午5時45分, Thomas Mueller <[email protected]> wrote: > Hi, > > I think in most cases it's better to *not* convert the date/time to > UTC (Coordinated Universal Time) before storing, because of following > problem: Let's say you store a birthday in the database. After that, > you close the database, and move the database file to a different time > zone. Then you open the database and read the birthday. If the > date/time is converted to UTC, then the birthday might change, which > is completely unexpected. This is an extreme example (you could say > "birthdays don't contain the time"). But also for other cases it's > more common to store the date/time in the local time zone, so that > moving a database file will not change the value. Please note the > problem is only moving the database file. > > I agree in some cases it would be better to convert the date to UTC, > but this you could also do in the application. > > I think most databases ignore the time zone by default when using the > "normal" data types DATE, DATETIME, or TIMESTAMP (that means, the > value doesn't change if you move a database file to a different time > zone). If you think this isn't true please tell me which database, and > provide a reproducible test case. I'm very interested to make H2 > compatible with other databases (I know some databases support > TIMESTAMP WITH TIME ZONE; this is not what I talk about - H2 simply > doesn't support storing the time zone - I'm talking about the normal > DATE, DATETIME and TIMESTAMP data types). > > Regards, > Thomas -- You received this message because you are subscribed to the Google Groups "H2 Database" 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/h2-database?hl=en.
