datetime « Date « Java Database Q&A

1. How to convert to

I am trying to use java.util.Date as input and then creating a query with it - so I need java.sql.Date. I was surprised to find that it couldn't do the ...

2. handling DATETIME values 0000-00-00 00:00:00 in JDBC

I get an exception (see below) if I try to do

for a JDBC connection to a MySQL database containing a DATETIME value of 0000-00-00 00:00:00 (the quasi-null value for DATETIME), ...

3. java.util.Date vs java.sql.Date

java.util.Date vs java.sql.Date: when to use which and why?

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

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 ...

5. Date format for datatype as Date/Time

As I have taken reg no as datatype number in ms access DB therefor we use Integer.parseInt for reg no. as i have taken name as text in ms access DB therefor we use ...

6. how do i create a custom date?

need some help! this is sort of a 2 part question.. ive done a decent amount of programming but ive never really worked with dates, ive googled and all that but finding ...

7. How can I convert a Timestamp into either Date or DateTime object?

I'm retrieving a timestamp object from a database using ResultSet.getTimestamp(), but I'd like an easy way to get the date in the format of MM/DD/YYYY and the time in a format ...

8. How to set current date and time using prepared statement?

I have a column in database having datatype DATETIME. I want to set this column value to current date and time using `PreparedStatement. How do I do that?