Subject | Re: [Firebird-Java] Date/Time with Prepared Statement |
---|---|
Author | Laurent Duperval |
Post date | 2008-01-31T16:31:49Z |
Ah, the joys of Java!
Use the SimpleDateFormat class to create a format that will understand
your date.
Then, stick your date and string together and pass it to the formatter.
It will give you a correct date in milliseconds, that you can use to
create a new Timestamp.
L
Thomas Steinmaurer wrote:
Use the SimpleDateFormat class to create a format that will understand
your date.
Then, stick your date and string together and pass it to the formatter.
It will give you a correct date in milliseconds, that you can use to
create a new Timestamp.
L
Thomas Steinmaurer wrote:
>[Non-text portions of this message have been removed]
> >> This works fine. But now I also want to handle the millisecond time
> >> information somehow (e.g. with a string 12:34:23.2345), but I don't
> see
> >> the obvious thing how to that with JDBC.
> >>
> >> What's the best way to handle date and time (incl. ms information)
> when
> >> the come along as a string with JayBird/JDBC?
> >
> > the setTimestamp in combination with java.sql.Timestamp.valueOf(...),
> > but you have to ensure the yyyy-mm-dd hh:mm:ss.fffffffff format of the
> > string (I think fraction seconds can be omitted).
>
> Hmm, ok.
>
> How to do that, if I don't have one TIMESTAMP field, but a DATE and a
> TIME field?
>
> I'm sorry, a Delphi guy is a bit confused regarding handling date/time
> in Java. ;-)
>
> Thanks!
>
> Thomas
>
>