Re: newbie question to setTimestamp( int parameterIndex, T
От | Peter.Zoche@materna.de |
---|---|
Тема | Re: newbie question to setTimestamp( int parameterIndex, T |
Дата | |
Msg-id | 3617A3C21370D045B75C0A40A7A6530D0B37E17F@ntexc2buc.do-office.buc.materna.com обсуждение исходный текст |
Список | pgsql-jdbc |
But I have stored my date and time information in a Calendar. Do I have to construct a Timestamp from it and then use setTimestamp( int index, Timestamp x) without the Calendar parameter? What about my timezone? -----Ursprüngliche Nachricht----- Von: Dave Cramer [mailto:pg@fastcrypt.com] Gesendet: Dienstag, 19. Juli 2005 13:00 An: Peter.Zoche@materna.de Cc: pgsql-jdbc@postgresql.org Betreff: Re: [JDBC] newbie question to setTimestamp( int parameterIndex, Timestamp x, Calendar cal) Peter, Timestamp is the actual time that you want to store. The calendar object is there if you want to use a different calendar to reference the timestamp to ? Dave On 19-Jul-05, at 6:49 AM, Peter.Zoche@materna.de wrote: > Hi all! > > I am new to postgresql and i have the following question: > > how does setTimestamp( int parameterIndex, Timestamp x, Calendar > cal) work? > why is there a parameter Timestamp? I have a Calendar in my java > code and I > would like to store it in the database via a PreparedStatement. So for > example: > > I have the following table: > > CREATE TABLE dates( date TIMESTAMP WITH TIME ZONE ); > > Java code: > > PreparedStatement ps = connection.prepareStatement( "INSERT INTO > dates (date) VALUES ?"); > ps.setTimestamp( 1, new Timestamp(), myCalendar ); > > Is this correct? But why is there a Timestamp parameter? It seems > clear that > the > calendar should be converted into a timestamp because the method is > named > setTimestamp. I am really confused about this. > > Please help > > Peter > > ---------------------------(end of > broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > >
В списке pgsql-jdbc по дате отправления: