|
Home > Archive > PostgreSQL JDBC > July 2005 > Re: newbie question to setTimestamp( int parameterIndex, Timestamp x, Calendar cal)
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: newbie question to setTimestamp( int parameterIndex, Timestamp x, Calendar cal)
|
|
|
| Hi,
This is 2 static method what convert from/to TimeStamp/GregorianCalendar:
public static Timestamp Gregorian2Timestamp(
GregorianCalendar
gregorianCalendar) {
return (gregorianCalendar == null ? null : new
java.sql. Timestamp(gregorianC
alendar. getTimeInMillis()));
}
public static GregorianCalendar Timestamp2Gregorian(
Timestamp timestamp) {
GregorianCalendar result = null;
if (timestamp != null) {
result = new GregorianCalendar();
result.setTime(new Date(timestamp.getTime()));
}
return (result);
}
linimi
On 7/19/05, Dave Cramer <pg@fastcrypt.com> wrote:
> 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:
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend
|
|
|
|
|