> 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.
> > 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
[quoted text clipped - 7 lines]
>
> 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
Bruce Lewis - 20 Mar 2007 15:22 GMT
> 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?
Read the API documentation about it. We humans understand the two
different ways you use "mm", but SimpleDateFormat has its own way of
differentiating minutes and months.

Signature
http://ourdoings.com/
Amazingly simple photo sharing
Manuel T - 23 Mar 2007 13:00 GMT
> Read the API documentation about it. We humans understand the two
> different ways you use "mm", but SimpleDateFormat has its own way of
> differentiating minutes and months.
Absolutely. Just use "mm" for minutes and "MM" for months.
Bye, Emanuele

Signature
Linux engine 2.6.17-11-generic i686 GNU/Linux
David Harper - 20 Mar 2007 20:14 GMT
[SNIP]
> Ian,
> by mistakly I said it as ""hh:mm dd/mm/yyyy" but it is ""hh:mm
[quoted text clipped - 5 lines]
> format. If that is the case again I have to split it as Ian said. Is
> that so or am i missing something?
You should read the Javadoc for java.text.SimpleDateFormat more carefully.
Lowercase 'm' denotes minutes in an hour, whereas uppercase 'M' denotes
months in a year. You cannot assume that you can use 'm' for both month
and minute.
You also need to beware of the distinction between 'h' and 'H' for the
hour. Both are valid, but they will yield different results.
Attention to detail is vital.
David Harper
Cambridge, England