Re: Storing GMT dates?

From: Tore Halset (halse..vv.ntnu.no)
Date: Fri Feb 29 2008 - 08:08:45 EST

  • Next message: David Marko: "EJBQLQuery and LEFT JOIN FETCH"

    Hello.

    Perhaps not that related, but you might want to take a look at JSR-310
    that tries to solve problems with the current java.util.Date & co. You
    should be able to create cayenne extended type(s) for JSR-310 until it
    is supported by jdbc.

    This video is a nice intro to JSR-310
    http://parleys.com/display/PARLEYS/JSR+310+-+Date+and+Time+API

      - Tore.

    On Feb 25, 2008, at 16:17 , Alexander Lamb wrote:

    > Hello,
    >
    > Using Cayenne 3.0M3, MySQL 5.
    >
    > I have a field which is a TIMESTAMP. It maps to a Java.util.Date
    > class in Java.
    >
    > If I do a myObject.setMyTimestamp(new Date()) I will store the local
    > date.
    >
    > I would like to store a GMT date.
    >
    > I tried doing this:
    >
    > Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
    >
    > myObject.setMyTimestamp(cal.getTime());
    >
    > but again, I am back to the local time. Indeed, a trace shows "cal"
    > is correctly set at the GMT value, but cal.getTime() is back to the
    > local time (or at least the printout is, but it is as if Cayenne
    > took the formated value and not the actual date value).
    >
    > How can I solve this problem?
    >
    > Thanks,
    >
    > Alex
    > --
    > Alexander Lamb
    > Founding Associate
    > RODANOTECH Sàrl
    >
    > 4 ch. de la Tour de Champel
    > 1206 Geneva
    > Switzerland
    >
    > Tel: 022 347 77 37
    > Fax: 022 347 77 38
    >
    > http://www.rodanotech.ch
    >
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Fri Feb 29 2008 - 08:09:28 EST