How to convert String to Java.sql.date and Java.sql.time

Posted by Mr Morgan on Stack Overflow See other posts from Stack Overflow or by Mr Morgan
Published on 2010-06-05T13:47:55Z Indexed on 2010/06/05 13:52 UTC
Read the original article Hit count: 396

Filed under:
|
|

Hello

If I have a method like this:

public static String convertDateTimeToString(DateTime dt) {
    return dt.getDate() + " " + dt.getTime();
}

Which takes a Datetime object of my own which contains a Java.sql.date and a Java.sql.time, what is the best way of reversing the process so that I can substring a Java.sql.date and a Java.sql.time from a string?

Or if DateTime dt is a JodaTime DateTime object?

If this can be done without reference to Java.util.date.

Thanks

Mr Morgan.

© Stack Overflow or respective owner

Related posts about java

Related posts about datetime