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)
im i

2005-07-19, 7:24 am

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

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com