Re: how to convert JAVA string in "hh:mm dd/mm/yyyy" to sql datetime format?
- From: "shivaraj" <shivaraj.malannavar@xxxxxxxxx>
- Date: 20 Mar 2007 03:28:43 -0700
On Mar 19, 4:53 pm, Arne Vajhøj <a...@xxxxxxxxxx> wrote:
shivaraj wrote:
In my JAVA code I have a string in "15:45 03/17/2007" this format.
Could any one let me know how can i insert/update it on to sql
database where the column is of type datetime ? If any one has a
sample code to do this, that will be great.
Use SimpleDateFormat parse to convert your string to a
java.util.Date and use a PreparedStatement for using
it in SQL (you need to wrap it in a java.sql.TimeStamp, but that
is trivial).
Arne
Hi Ian/Arne,
Thanks for your comments.
Ian,
by mistakly I said it as ""hh:mm dd/mm/yyyy" but it is ""hh:mm
mm/dd/yyyy" format. I will try splitting that string into date and
time and try to use it as sql date format.
Arne,
To try with this approach, I am not getting any patterns in
"hh:mm mm/dd/yyyy" in SimpleDateFormat to convert it into java date
format. If that is the case again I have to split it as Ian said. Is
that so or am i missing something?
Regards,
Shivaraj
.
- Follow-Ups:
- Re: how to convert JAVA string in "hh:mm dd/mm/yyyy" to sql datetime format?
- From: David Harper
- Re: how to convert JAVA string in "hh:mm dd/mm/yyyy" to sql datetime format?
- From: Bruce Lewis
- Re: how to convert JAVA string in "hh:mm dd/mm/yyyy" to sql datetime format?
- References:
- Prev by Date: Re: how to convert JAVA string in "hh:mm dd/mm/yyyy" to sql datetime format?
- Next by Date: Re: how to convert JAVA string in "hh:mm dd/mm/yyyy" to sql datetime format?
- Previous by thread: Re: how to convert JAVA string in "hh:mm dd/mm/yyyy" to sql datetime format?
- Next by thread: Re: how to convert JAVA string in "hh:mm dd/mm/yyyy" to sql datetime format?
- Index(es):
Relevant Pages
|
|